void main()

{

int i;

char a[]="\0";

if(printf("%s\n",a))

printf("Ok here \n");

else

printf("Forget it\n");

}

Answers were Sorted based on User's Feedback



void main() { int i; char a[]="\0"; if(printf("%s\n",a)) pri..

Answer / susie

Answer :

Ok here

Explanation:

Printf will return how many characters does it print. Hence
printing a null character returns 1 which makes the if
statement true, thus "Ok here" is printed.

Is This Answer Correct ?    14 Yes 4 No

void main() { int i; char a[]="\0"; if(printf("%s\n",a)) pri..

Answer / rahul bagale

Ans :Forget it

Explation:

'' is a char with value 0 in C++ and an int with the value 0 in C.

Is This Answer Correct ?    1 Yes 3 No

void main() { int i; char a[]="\0"; if(printf("%s\n",a)) pri..

Answer / sunder.r

answewr: forget it

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More C Code Interview Questions

How do you create a really large matrix (i.e. 3500x3500) in C without having the program crash? I can only reach up to 2500. It must have something to do with lack of memory. Please help!

1 Answers  


#include <stdio.h> int main(void) { int a=4, b=2; a=b<<a+b>>2 ; printf("%d",a); return 0; }

0 Answers   Student,


main() { char c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; }

1 Answers  


main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }

1 Answers  


What is full form of PEPSI

0 Answers  






Finding a number multiplication of 8 with out using arithmetic operator

8 Answers   Eyeball, NetApp,


void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }

2 Answers  


void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(“%d”,k); }

1 Answers  


void main() { static int i; while(i<=10) (i>2)?i++:i--; printf(“%d”, i); }

2 Answers  


#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }

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,


void main() { int i=5; printf("%d",i+++++i); }

3 Answers  


Categories