I'm just starting and working on some very easy programs. I was doing a few little programs that use the scanf() function, such as taking the input of 4 numbers and printing out the average or a program that subtracts 2 numbers from one another, and couldnt get anything to work. I'm using ms visual c++ 6.0 on win98.
So then I tried this program:
#include <stdio.h>
main()
{
int a;
scanf("enter a value %d ", &a);
printf("a contains %d ", a);
return 0;
}
The value of a (and all values I try scan f'ing in) ends up being something ridiculous like -823460123. Any ideas what is up with this?
http://cboard.cprogramming.com/showt...t=scanf+result This thread says scanf has problems...is this my case?
I've tried the suggestions in these threads:
http://cboard.cprogramming.com/showt...t=scanf+result
and another 1 I cant find the link to now. Any help appreciated.