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

1 o 1 1 0 1 0 1 0 1 1 0 1 0 1 how to design this function format in c-language ?

2 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  


how to delete an element in an array

2 Answers   IBM,


main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }

1 Answers   Zoho,


{ int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }

4 Answers  






void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }

1 Answers  


#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf("%d %d ",z,x); }

1 Answers  


Program to Delete an element from a doubly linked list.

4 Answers   College School Exams Tests, Infosys,


Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.

2 Answers   Wipro,


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

1 Answers  


main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }

2 Answers   Wipro,


What are the following notations of defining functions known as? i. int abc(int a,float b) { /* some code */ } ii. int abc(a,b) int a; float b; { /* some code*/ }

1 Answers  


Categories