Friday 22 March 2013

char a[]="12345\0";


    void main()
{
    char a[]="12345\0";
    int i=strlen(a);
    printf("here in 3 %d\n",++i);
}
Answer:
here in 3 6
Explanation:
    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, the 6 will be printed.
   
Blog Author: Vijay Kumar

No comments:

Post a Comment