main()
{
char *ptr = "Ramco Systems";
(*ptr)++;
printf("%s\n",ptr);
ptr++;
printf("%s\n",ptr);
}
Find the Outputs?

Answer Posted / chappa

The first increment is incorrect, since it will try to
increment the value of 'R' but will end up giving
Segmentation fault.

Second ptr++ is valid as it will shift the pointer from 'R'
to 'a'. The second print statement would have printed "amco
Systems", the compiler gives Seg fault due to the previous
incorrect increment.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a dynamic array in c?

581


Ow can I insert or delete a line (or record) in the middle of a file?

564


What is a pointer in c plus plus?

682


Why do we use & in c?

579


How are pointers declared in c?

586






What is a lookup table in c?

616


What is the advantage of c?

604


What is the use of a ‘’ character?

576


how to introdu5ce my self in serco

1517


What is the description for syntax errors?

604


Using which language Test cases are added in .ptu file of RTRT unit testing???

3570


What is string function c?

558


what do u mean by Direct access files? then can u explain about Direct Access Files?

1633


Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff

2229


which is conditional construct a) if statement b) switch statement c) while/for d) goto

726