Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Need Help in Pointer (http://www.go4expert.com/forums/help-pointer-t8136/)

michaelrichards 7Jan2008 10:52

Need Help in Pointer
 
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:


All times are GMT +5.5. The time now is 09:36.