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 are the 5 organizational structures?
Why do we use int main?
What is sizeof return in c?
in iso what are the common technological language?
what is reason of your company position's in india no. 1.
What are the keywords in c?
List some of the static data structures in C?
in linking some of os executables are linking name some of them
write a program to find out prime number using sieve case?
what is the height of tree if leaf node is at level 3. please explain
What is the usage of the pointer in c?
What is a node in c?
What is the function of this pointer?
What is difference between structure and union with example?
What are shell structures used for?