a simple basic question...
hello every1..
m a newbie to programming and am seeking help for this simple question i have...
#include<stdio.h>
main()
{
int a;
printf("%d",a);
}
the output for the above program gives me something as 19345234...
the value being displayed here is the location of the memory? or simply some garbage value tat already occupies the memory block from before...?
wat should i add to this program so that the output displayed is null...?
Re: a simple basic question...
You haven't assigned any value to a, so the value of a is undefined when you print it.
Re: a simple basic question...
yea fine... i accept tat too... but wat is the value tat is being diplayed here?
Re: a simple basic question...
It's the value of the variable a. a is located on the stack. Since you haven't assigned anything to it, whatever bits happened to be set in that location are interpreted as an int and printed.
Re: a simple basic question...
Quote:
Originally Posted by
xen_
yea fine... i accept tat too... but wat is the value tat is being diplayed here?
You need to get the h key on your keyboard checked.
Re: a simple basic question...
Tat vaL is like rite woteva, ya now? its like wot was in dat like space wen u md yr like a
Re: a simple basic question...
hmmm... i get it nw... thxx a lot...
wt shud i add here so as to free up the memory?
realloc() should work?
Re: a simple basic question...
You aren't doing any manual memory management here. There's nothing to clean up.