<quote who="Rajnish Tiwari">
> In C, I have the following declaration:
>
> int foo()
> {
> char* bar;
>
>
> };
>
> If unitialised, what the the value of variable "bar" ?
> Will it get initialised to 0 or be a random value ?
> Is the value allocated at runtime or compile time ?
It will be essentially a random value, but often 0.
C won't do any initialisation for you, but if it's the first time your
process has used that particular piece of stack, the kernel will
have initialised it to 0.
If you need a variable to have a particular value in C, always initialise it
explicitly.
J.
--
Jan Schmidt [EMAIL PROTECTED]
Have you been half-asleep? Have you heard voices?
I've heard them calling my name...
-Kermit the Frog (Rainbow Connection)
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html