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() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a. Runtime error. b. I am OK c. Compile error d. I am O

4 Answers   HCL,


Is the following code legal? struct a { int x; struct a b; }

1 Answers  


Question: We would like to design and implement a programming solution to the reader-writer problem using semaphores in C language under UNIX. We assume that we have three readers and two writers processes that would run concurrently. A writer is to update (write) into one memory location (let’s say a variable of type integer named temp initialized to 0). In the other hand, a reader is to read the content of temp and display its content on the screen in a formatted output. One writer can access the shared data exclusively without the presence of other writer or any reader, whereas, a reader may access the shared memory for reading with the presence of other readers (but not writers).

1 Answers  


write a program for area of circumference of shapes

0 Answers  


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

1 Answers  






Display the time of the system and display the right time of the other country

1 Answers  


Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.

1 Answers  


why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?

0 Answers  


main() { int i=10; void pascal f(int,int,int); f(i++,i++,i++); printf(" %d",i); } void pascal f(integer :i,integer:j,integer :k) { write(i,j,k); }

1 Answers  


main() { int i=-1; -i; printf("i = %d, -i = %d \n",i,-i); }

1 Answers  


main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above

3 Answers   BrickRed, HCL,


main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }

6 Answers  


Categories