#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/

### Like this:

Like Loading...

*Related*

## Published by Shahab

Completed B.Sc in CSE, @United International University, Dhaka.
Currently working as Development Engineer, Android and iOS Application.
View all posts by Shahab

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

Here is 3 6

here is 3 6

here is 3 6

here is 36

here is 36″Becouse 1 2 3 4 5 ” and ++i ,string start from 0 to array define so 1=0,2=1,3=2…….++i increment the value which occopy by null charactor .null charactor value here 5 and after increment 6 now we have 6 and printf defination has already 3 ,so combination is 36

here is 36

3 6

here is 3 6

here is 3 6

here is 36

here is 3 6

here is 3 6

here is 3 6

here is 37

here is 3 6

here is 3 6