ExamVeda
Login
Home
This question belongs to C Program C Miscellaneous
C Miscellaneous
?

Determine Output:
void main()
{
      char a[]="12345"; 
      int i = strlen(a); 
      printf("%d", ++i);
}

Answer & Solution
Correct Answer: Option B

The char array 'a' will hold the initialized string, whose length will be counted from 0 till the null character. Hence the 'i' will hold the value equal to 5, after the pre-increment in the printf statement, then 6 will be printed.

Examveda
Question posted by Examveda
Community

Join the Discussion

3 Comments
MAITHILI JAYALE
MAITHILI JAYALE 6 years ago
Ans must be 7
Sriram Dandamudi
Sriram Dandamudi 10 years ago
answer is compilition error since header file is not written completely.
Hemendra Kumar
Hemendra Kumar 11 years ago
7 is the answer