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
When should the register modifier be used? Does it really help?
What is wrong with this code?
How can I get random integers in a certain range?
Is there a way to jump out of a function or functions?
How do you determine whether to use a stream function or a low-level function?
What is the use of function in c?
What type of function is main ()?
how to find anagram without using string functions using only loops in c programming
I need testPalindrome and removeSpace
#include
How can you draw circles in C?
What is pointer and structure in c?
What is the use of typedef in structure in c?
What is function prototype in c with example?
Explain what is the benefit of using an enum rather than a #define constant?
What are operators in c?