Examveda
Examveda

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

A. 5

B. 6

C. 7

D. None of These

Answer: Option B

Solution(By Examveda Team)

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.


This Question Belongs to C Program >> C Miscellaneous

Join The Discussion

Comments ( 3 )

  1. MAITHILI JAYALE
    MAITHILI JAYALE :
    3 years ago

    Ans must be 7

  2. Sriram Dandamudi
    Sriram Dandamudi :
    8 years ago

    answer is compilition error since header file is not written completely.

  3. Hemendra Kumar
    Hemendra Kumar :
    8 years ago

    7 is the answer

Related Questions on C Miscellaneous