Mail Archives: djgpp/1998/10/12/10:26:38
see below...
> Hya,
> does anyone know why the code below displays always the same: 317072
> 317068. And to get it read and print data properly?
> thanx
>
> #include <conio.h>
> void prompt( int &hrs, int &mnts)
> {
>
> printf("Plz enter begining time, separating hours & minutes");
> scanf ("%d %d", &hrs, &mnts);
>
> }
> int main()
> {
> int hrs1, mnts1;
>
> prompt( hrs1, mnts1);
> printf ("U entered %d and %d", &hrs1, &mnts1);
^^^^^^^^^^^^^
right here. I believe this will be interpreted as the address of hrs1 and
mnts1 when passed to printf (printf being a "C" function). Try just ...
printf ("U entered %d and %d", hrs1, mnts1);
> return 0;
> }
Hope that helps
Alan Bork
- Raw text -