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 c programing language?
What are the types of i/o functions?
What is c system32 taskhostw exe?
What is difference between arrays and pointers?
Are there constructors in c?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
can any one tel me wt is the question pattern for NIC exam
What is #line used for?
hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm
Do array subscripts always start with zero?
How do I swap bytes?
Is void a keyword in c?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
Write a program of prime number using recursion.
Why calloc is better than malloc?