Problem : 1
October 13, 2009 13 Comments
#include <stdio.h>
#include <string.h>
int main()
{
char a [] = "12345";
int i = strlen (a);
printf ("here is 3 %d\n",++i);
}
// What's the output ? [Do not execute / run]
// post your answer as a comment
// Source : http://www.youngprogrammer.com/


Should be “here is 3 6″ and a new line.
here is 3 6
here is 3 7
:p
here is 3 6
here is 3 6
char a [] = “12345″;
we haven’t defined the size of the array in declaration. This enables us to initialize values and the compiler will allocate necessary spaces.
int i = strlen (a);
The length of the array is determined by the number of character elements. strlen () returns the length of a string. here, i = 5
printf (“here is 3 %d\n”,++i);
the value of ‘i’ is pre-incremented. that is, the value of ‘i’ will be incremented before printing.
and, “here is 3″ is concatenated with the output to fuddle u.
Correct Output : here is 3 6
here is 3 6
upload python problems.
Should be “here is 3 6″ and a new line.
should be ‘here is 3 6′
6
Ans: 36