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


Please Help Members By Posting Answers For Below Questions

Can you assign a different address to an array tag?

800


What is ## preprocessor operator in c?

706


An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

753


Why c is called top down?

718


How can I sort more data than will fit in memory?

745






What do the functions atoi(), itoa() and gcvt() do?

816


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?

696


Write a program for Overriding.

811


Why is c called "mother" language?

948


What is void pointers in c?

678


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

1567


Why isnt any of this standardized in c?

735


Whats s or c mean?

685


Is linux written in c?

683


What is scope of variable in c?

654