GATE | GATE CS Mock 2018 | Question 55
Predict the output?
*str2 = str1;
*str = \"GeeksQuiz\";
The function fun() basically counts number of characters in input string. Inside fun(), pointer str2 is initialized as str1. The statement while(*++str1); increments str1 till ‘\\0’ is reached. str1 is incremented by 9. Finally the difference between str2 and str1 is returned which is 9.
Option (B) is correct.
Quiz of this Question
Please comment below if you find anything wrong in the above post
Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing Data Science & AI
as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.