modify(char a[],char *b)
{
a[0]='a'//gives runtime error why?
b[0]='b'//gives runtime error
}
main()
{
char p[]="hello";
char *x="hello";
x[0]='x';//will give run time error i know why
p[0]='p' //works fine i know why
modify("string","pointer");
}
why un function modify both the assignments give runtiie error are both a
and b acting as pointers to some constant strings
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.