[algogeeks] Re: C output 2

2011-07-27 Thread private.joker
Passing a pointer across functions does not create any problem and doesn't cause memory leak. but passing an array ,for eg int *fun() { int a[12]; return a; } this creates memory leak as the call stack no more holds the array. So, in essence, though int *a and int a[] behave quite similarly on

[algogeeks] Re: C output 2

2011-07-27 Thread Abhinav Arora
No it will not cause a memory leak as its a string literal and it behaves more like a read only entity. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/_4F

[algogeeks] Re: C output 2

2011-07-27 Thread amit
"hello" is a string literal and this is what the C standard says about string literals: >> The multibyte character sequence is then used to initialize an array of >> static storage duration and length just >> sufficient to contain the sequence. So memory will remain reserved for "hello" for the e