![]() |
Scope of character pointer and character array in a function
Hi,
Following are two programs which behave differently for same situtaion. Code:
Code:
Both variable inside function "somfun" are having local scope even after that first program is printing the value of t...how is it possible??????? |
Re: Scope of character pointer and character array in a function
Neither is correct, because in both cases t is on the stack and invalid after the function returns.
This is correct, but you must remember to free the memory some time later otherwise this will leak memory: Code:
char *morefun() |
| All times are GMT +5.5. The time now is 13:56. |