in Programming in C
583 views
1 vote
1 vote

consider following code segment  in c

main()

{

char * z="abc";

z[0]='x';

printf("%s",z);

}

what will be behavior of the program

a>compiler error   b>runtime error c>no error prints xbc

d>no error prints abc

in Programming in C
583 views

2 Answers

0 votes
0 votes
0 votes
0 votes
If contents of string constant is modified, the behavior is undefined in C.

Related questions