Hi,
I have a small query ..like whenever any variable is declared and used in
one function , then scope won't be there outside of that function. Then how
will be case with pointers?
like..
#influde<stdio.h>
char * fun()
{
char *x="Gopi"; // -->Is this initialisation correct?
return x;
}
main()
{
char *k=new char(5);
k=fun();
}
Here k got value "Gopi"; But x is declared only in function "fun()". Does it
mean , for variables whose memory allocated in heap instead of stack will
remain till the end of program?
GopiKrishna Komanduri
Software engineer
Covansys,
Chennai,
9884965748.
[EMAIL PROTECTED]
---------------------------------
Pinpoint customers who are looking for what you sell.
[Non-text portions of this message have been removed]