At 2004-03-04 12:24:25 +0530, [EMAIL PROTECTED] wrote: > > According to me, as we have "string" as local variable, it should vanish. > But, i am still able to return and print the string "hello world".
Returning a pointer to local variables is undefined; that is, there is no guarantee whatsoever about its behaviour. In particular, it doesn't need to "vanish" (but it may). So your code works only by accident. I'm surprised that gcc's warnings are defeated by your intermediate assignment (ptr = string), but only a little. > When I change to : > char string[200]="hello world"; > and do not use strcpy(), > It shows junk, the behaviour is as per my expectations. (Coincidence. As it happens, it works for me even without the strcpy.) -- ams _______________________________________________ ilugd mailinglist -- [EMAIL PROTECTED] http://frodo.hserus.net/mailman/listinfo/ilugd Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi http://www.mail-archive.com/[EMAIL PROTECTED]/