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
Explain built-in function?
What is the data segment that is followed by c?
What are the 4 types of functions?
What is sizeof in c?
Is a pointer a kind of array?
Explain the Difference between the New and Malloc keyword.
What does dm mean sexually?
What is scanf () in c?
Is linux written in c?
What is the use of a semicolon (;) at the end of every program statement?
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }
What is a wrapper function in c?
What is fflush() function?
How will you declare an array of three function pointers where each function receives two ints and returns a float?