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?
EDIT: Please read the "Before you make a query" thread (see the upper right corner of this page).

Last edited by DaWei; 21Aug2007 at 13:50.. Reason: Add code tags