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

Need Help in Pointer

Discussion in 'C' started by michaelrichards, Jan 7, 2008.

  1. michaelrichards

    michaelrichards New Member

    Joined:
    Jan 7, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    System Programmer
    Location:
    India
    Hi there,

    I need your help in pointer. I have problem to copy a String from one to another by just passing one string address to another.

    see the snippet,


    void main()
    {
    char *str= "ABC";
    char *str1="DEF";
    COPY(str,str1);

    printf("%s",str);

    }

    void COPY(char *String1, char *String2)
    {
    String1=String2;
    }

    If I run this program my system hanging after printing 'str'.:crazy:

    Why this was happening?

    Can you help me? :happy:
     

Share This Page