#include<stdio.h>
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s;
printf("%d",s->x);
printf("%s",s->name);
}
Answers were Sorted based on User's Feedback
Answer / susie
Answer :
Compiler Error
Explanation:
You should not initialize variables in declaration
| Is This Answer Correct ? | 10 Yes | 3 No |
Answer / anand
Compilation error
you should not iniialize the structure variable inside the
declaration.
| Is This Answer Correct ? | 4 Yes | 2 No |
There is no syntax error.
Pointer s is declared but never initialized.
Using uninitialized pointer , trying to access members(x and name) of structure results in invalid access of memory.
Hence segmentation fault.
| Is This Answer Correct ? | 0 Yes | 0 No |
Write a procedure to implement highlight as a blinking operation
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
hello sir,is there any function in C that can calculate number of digits in an int type variable,suppose:int a=123; 3 digits in a.what ll b answer?
Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };
void main() { int c; c=printf("Hello world"); printf("\n%d",c); }
Write a program that produces these three columns sequence nos. using loop statement Sequence nos. Squared Squared + 5 1 1 6 2 4 9 3 9 14 4 16 21 5 25 30
How to palindrom string in c language?
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"); }
main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }
9 Answers CSC, GoDB Tech, IBM,
which function is used to clear the buffer stream on gcc? for example: I wrote following code on gcc #include<stdio.h> int main(void) { char ch; int a,b; printf("\nenter two numbers:\t"); scanf("%d%d",&a,&b); printf("enter number is %d and %d",a,b); printf("\nentercharacter:\t"); scanf("%c",&ch); printf("enter character is %c",ch); return 0; } in above progarm ch could not be scan. why?plz tell me solution.
main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }
how to return a multiple value from a function?