the output I'm getting is : 134513691Code:#include <stdio.h> int main() { int a=100; int c; printf("%d\n", c); c = a * a; }
any ideas as to why I would be getting this output thanks.
figured it out have to declare before the printf statement.
the output I'm getting is : 134513691Code:#include <stdio.h> int main() { int a=100; int c; printf("%d\n", c); c = a * a; }
any ideas as to why I would be getting this output thanks.
figured it out have to declare before the printf statement.
Last edited by d387420489; 07-28-2011 at 06:00 PM. Reason: solved
Because you initialize 'c' after you use it in your "printf()" function. Therefore, it can be any random value.
EDIT: beatbox beat me to it!
And if your "main()" function says it returns an integer ... then make sure it actually returns an integer! Typically, for a successful termination, you would:
Code:return 0;
thanks for the info I still have a lot to learn
Really???? - This post just might make my tag line. Where is quzah, I need a new quote!!!
I would suggest you take a look at the following:
Cprogramming - Tutorials
Cprogramming - FAQs
Additionally, set your compiler up so it treats "All warnings as errors" If you did that the compiler would have flagged using c without it being initialized.