#include<stdio.h>

main()

{

struct xx

{

int x=3;

char name[]="hello";

};

struct xx *s=malloc(sizeof(struct xx));

printf("%d",s->x);

printf("%s",s->name);

}



#include<stdio.h> main() { struct xx { ..

Answer / susie

Answer :

Compiler Error

Explanation:

Initialization should not be done for structure members
inside the structure declaration

Is This Answer Correct ?    4 Yes 1 No

Post New Answer

More C Code Interview Questions

A program that will create a movie seat reservation. The program will display the summary seats and its status. The user will be ask what seat no. to be reserved, then it will go back again to the summary to display the updated seat status. If the seat no. is already reserved then it will prompt an error message. And also if the input seat no is out of range then it will also prompt an error message. The program is continuously running. Termination of the program will depends on how the programmer will apply. Sample output: Movie Seats Reservation Summary of Seats: Seat 1: Available Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 1 Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 6 The Seat no. is out of range! Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 1 The Seat no. is already reserved! Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 0 GoodBye... Thank You!!!

0 Answers  


String reverse with time complexity of n/2 with out using temporary variable.

10 Answers   NetApp, Symantec,


write a c program to Create a mail account by taking the username, password, confirm password, secret_question, secret_answer and phone number. Allow users to register, login and reset password(based on secret question). Display the user accounts and their details .

2 Answers  


posted by surbhi just now main() { float a = 5.375; char *p; int i; p=(char*)&a; for(i=0;i<=3;i++) printf("%02x",(unsigned char) p[i]); } how is the output of this program is :: 0000ac40 please let me know y this output has come

2 Answers   GATE,


What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;

1 Answers  






why is printf("%d %d %d",i++,--i,i--);

4 Answers   Apple, Cynity, TCS,


void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }

2 Answers  


main(int argc, char **argv) { printf("enter the character"); getchar(); sum(argv[1],argv[2]); } sum(num1,num2) int num1,num2; { return num1+num2; }

1 Answers  


create a login program that ask username and password. if you input username or password 3 times wrong, the program will terminate else the program will prompt a message "congratulations"

2 Answers  


how can i search an element in an array

2 Answers   CTS, Microsoft, ViPrak,


How to palindrom string in c language?

6 Answers   Google,


int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }

3 Answers   Cisco, HCL,


Categories