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
Can you assign a different address to an array tag?
What is ## preprocessor operator in c?
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
Why c is called top down?
How can I sort more data than will fit in memory?
What do the functions atoi(), itoa() and gcvt() do?
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
Write a program for Overriding.
Why is c called "mother" language?
What is void pointers in c?
i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me
Why isnt any of this standardized in c?
Whats s or c mean?
Is linux written in c?
What is scope of variable in c?