Mail Archives: djgpp/1999/12/06/10:42:51
On Mon, 6 Dec 1999, Jason Yip wrote:
) whatever I input, say 4.0 5.0, the output is always =0 . why??
) pls tell me. thx..
scanf() puts values into the memory pointed to by the arguments you give it,
and in your code it's trying to put the values into the memory locations
pointed to by your uninitialized a and b variables (ie, it's treating a and
b as pointers). What you really want is to pass pointers *to* a and b to
scanf.
) main ()
) {double a,b,s;
) printf("Enter the sides of the triangle: ");
) scanf("%lf%lf",a,b);
scanf("%lf%lf, &a, &b);
--
Daniel Reed <n AT ml DOT org>
Misspelled? Impossible. My modem is error correcting!
- Raw text -