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
What is a dynamic array in c?
Ow can I insert or delete a line (or record) in the middle of a file?
What is a pointer in c plus plus?
Why do we use & in c?
How are pointers declared in c?
What is a lookup table in c?
What is the advantage of c?
What is the use of a ‘ ’ character?
how to introdu5ce my self in serco
What is the description for syntax errors?
Using which language Test cases are added in .ptu file of RTRT unit testing???
What is string function c?
what do u mean by Direct access files? then can u explain about Direct Access Files?
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
which is conditional construct a) if statement b) switch statement c) while/for d) goto