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 the difference between the = symbol and == symbol?
What are the different types of control structures?
What are reserved words with a programming language?
What is 1f in c?
What is time null in c?
main() { printf("hello"); fork(); }
How can you access memory located at a certain address?
What is meant by realloc()?
What does 3 mean in texting?
What is graph in c?
By using C language input a date into it and if it is right?
Why dont c comments nest?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
Is it possible to use curly brackets ({}) to enclose single line code in c program?
What are header files in c?