main()
{
char a[4]="HELL";
printf("%s",a);
}

Answers were Sorted based on User's Feedback



main() { char a[4]="HELL"; printf("%s",a); }..

Answer / susie

Answer :
HELL%@!~@!@???@~~!

Explanation:
The character array has the memory just enough to hold the
string “HELL” and doesnt have enough space to store the
terminating null character. So it prints the HELL correctly
and continues to print garbage values till it accidentally
comes across a NULL character.

Is This Answer Correct ?    25 Yes 10 No

main() { char a[4]="HELL"; printf("%s",a); }..

Answer / harshawardhan

HELL

It will print "HELL" because Character array of size 0 to 4 mean it may hold 5 places. One for Null character and other four for HELL total 5.

Is This Answer Correct ?    3 Yes 0 No

main() { char a[4]="HELL"; printf("%s",a); }..

Answer / thiyagu

hell

Is This Answer Correct ?    1 Yes 6 No

Post New Answer

More C Code Interview Questions

main() { int y; scanf("%d",&y); // input given is 2000 if( (y%4==0 && y%100 != 0) || y%100 == 0 ) printf("%d is a leap year"); else printf("%d is not a leap year"); }

1 Answers  


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,


Printf can be implemented by using __________ list.

3 Answers  


#include<stdio.h> #include<conio.h> void main() { int a=(1,2,3,(1,2,3,4); switch(a) { printf("ans:"); case 1: printf("1");break; case 2: printf("2");break; case 3: printf("1");break; case 4: printf("4");break; printf("end"); } getch(); }

0 Answers  


Program to Delete an element from a doubly linked list.

4 Answers   College School Exams Tests, Infosys,






main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }

2 Answers   IBM,


main() { char str1[] = {‘s’,’o’,’m’,’e’}; char str2[] = {‘s’,’o’,’m’,’e’,’\0’}; while (strcmp(str1,str2)) printf(“Strings are not equal\n”); }

1 Answers  


main() { int i = 257; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }

1 Answers   CSC,


programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h

1 Answers  


void main() { int x,y=2,z; z=(z*=2)+(x=y=z); printf("%d",z); }

4 Answers  


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

4 Answers  


what is the code of the output of print the 10 fibonacci number series

2 Answers  


Categories