4.What will be printed as the result of the operation below: main() { char *ptr = ” Cisco Systems”; *ptr++; ptr++; printf(“%sn”,ptr); }

  1. Cisco System

  2. isco Systems

  3. Cisco Systems

  4. Cisco


Correct Option: B
Explanation:

To solve this question, the user needs to understand how pointers work in C and the order of operations in the given code.

Initially, ptr points to the first character of the string "Cisco Systems".

The expression *ptr++ increments the pointer ptr to point to the next character, but dereferences the original pointer to get the value of the first character. Therefore, this operation has no effect on the value of ptr.

The expression ptr++ increments the pointer again, so that it now points to the second character of the string.

Finally, the printf function is called, which outputs the string starting from the second character.

Therefore, the correct answer is:

The Answer is: B. isco Systems

Find more quizzes: