void main()

{

char a[]="12345\0";

int i=strlen(a);

printf("here in 3 %d\n",++i);

}

Answers were Sorted based on User's Feedback



void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %..

Answer / susie

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.

Is This Answer Correct ?    18 Yes 4 No

void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %..

Answer / lucky varshney

here in 3
7

Is This Answer Correct ?    4 Yes 6 No

void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %..

Answer / ravneet kaur

as this is a character array and would have string in double
quotes so this code shows an error i.e. *char wont changes
to *int.

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More C Code Interview Questions

Finding a number which was log of base 2

1 Answers   NetApp,


main() { float i=1.5; switch(i) { case 1: printf("1"); case 2: printf("2"); default : printf("0"); } }

2 Answers  


write a program in c to merge two array

2 Answers  


Print an integer using only putchar. Try doing it without using extra storage.

2 Answers  


writte a c-programm to display smill paces

2 Answers  






Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

1 Answers  


main() { signed int bit=512, mBit; { mBit = ~bit; bit = bit & ~bit ; printf("%d %d", bit, mBit); } } a. 0, 0 b. 0, 513 c. 512, 0 d. 0, -513

3 Answers   HCL, Logical Computers,


#define a 10 void foo() { #undef a #define a 50 } int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } explain the answer

1 Answers  


main() { char *p = "hello world"; p[0] = 'H'; printf("%s", p); } a. Runtime error. b. “Hello world” c. Compile error d. “hello world”

5 Answers   HCL,


#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }

1 Answers  


main() { static char names[5][20]={"pascal","ada","cobol","fortran","perl"}; int i; char *t; t=names[3]; names[3]=names[4]; names[4]=t; for (i=0;i<=4;i++) printf("%s",names[i]); }

2 Answers  


respected sir, i did my MCA in 2013 when i am going to attend to an interview i was asked about my project how will i explain my project could please help me in this and my project title is "Social Networking Site For Social Responsibility"

1 Answers   Genpact, Ozdocs,


Categories