Can someone pls explain the difference between these two especially in
terms of scope... one example i have come across is
        1.
        char *xxx(int n)
        {
        char *retbuf = malloc(25);
        if(retbuf == NULL)
                return NULL;
        sprintf(retbuf, "%d", n);
        return retbuf;
        }

        2.
        char *xxx(int n)
        {
        char retbuf[25];
        sprintf(retbuf, "%d", n);
        return retbuf;
        }

First one is correct and the second one is wrong... why does the scope
of retbuf extends to the calling function...
am just a beginner so ignore the stupidity(if any).....

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to