main()
{
char a[4]="HELLO";
printf("%s",a);
}
Answers were Sorted based on User's Feedback
Answer / dani
Actually I compiled this and ran it unix and it just prints out a warning, not an error:
"warning: initializer-string for array of chars is too long"
The programme prints the initial array without the last character (because of the '\0' special character):
"HELL �"
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / susie
Answer :
Compiler error: Too many initializers
Explanation:
The array a is of size 4 but the string constant requires 6
bytes to get stored.
Is This Answer Correct ? | 2 Yes | 2 No |
#include<stdio.h> main() { FILE *ptr; char i; ptr=fopen("zzz.c","r"); while((i=fgetch(ptr))!=EOF) printf("%c",i); }
main() { int x=5; for(;x!=0;x--) { printf("x=%d\n", x--); } } a. 5, 4, 3, 2,1 b. 4, 3, 2, 1, 0 c. 5, 3, 1 d. none of the above
int aaa() {printf(“Hi”);} int bbb(){printf(“hello”);} iny ccc(){printf(“bye”);} main() { int ( * ptr[3]) (); ptr[0] = aaa; ptr[1] = bbb; ptr[2] =ccc; ptr[2](); }
Sir... please give some important coding questions asked by product companies..
WAP to display 1,2,3,4,5........N
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]); }
Write a procedure to implement highlight as a blinking operation
What is the hidden bug with the following statement? assert(val++ != 0);
/*what is the output for*/ void main() { int r; printf("Naveen"); r=printf(); getch(); }
main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }
main() { float f=5,g=10; enum{i=10,j=20,k=50}; printf("%d\n",++k); printf("%f\n",f<<2); printf("%lf\n",f%g); printf("%lf\n",fmod(f,g)); }
Write a program to print a square of size 5 by using the character S.