1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

what will be the output?

Discussion in 'C' started by indian.21987, Aug 21, 2007.

Thread Status:
Not open for further replies.
  1. indian.21987

    indian.21987 New Member

    Joined:
    Aug 19, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    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 a moderator: Aug 21, 2007
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
Thread Status:
Not open for further replies.

Share This Page