Machine-translated by Google. Questions are authored in English.
Top

Discussion

In below program, what would you put in place of “?” to print “Quiz”?

#include <stdio.h> 
int main()  
{  
  char arr[] = "GeeksQuiz";  
  printf("%s", ?);  
  return 0;  
} 

 

  • A.arr
  • B.(arr+5)
  • C.(arr+4)
  • D.Not possible

Answer: B

Correct answer: (arr+5)

"GeeksQuiz" has Q at index 5, counting from 0, so arr+5 points at the start of Quiz and %s prints from there to the terminating null. arr+4 would give sQuiz.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.