what will be the output?

Light Poster
21Aug2007,13:03   #1
indian.21987's Avatar
Code:
main() 
{ 
        char *p1=“name”; 
        char *p2; 
        p2=(char*)malloc(20); 
        memset (p2, 0, 20); 
        while(*p2++ = *p1++); 
        printf(“%s\n”,p2); 

}

Also what is the use of malloc() function?

Last edited by shabbir; 21Aug2007 at 14:53.. Reason: Code block
Go4Expert Founder
21Aug2007,14:54   #2
shabbir's Avatar
Duplicate of what will the output?. Thread closed.