Knowee
Questions
Features
Study Tools

Which of the following structure(s) is/are correct?  Tick all correct answer(s)  No partial marks and no negative marks.Select one or more:struct aa {     int a;     float b; };struct aa {     int a;     float b;     struct aa var; };struct aa {     int a;     float b;     struct aa *var; };

Question

Which of the following structure(s) is/are correct?  Tick all correct answer(s)  No partial marks and no negative marks.Select one or more:struct aa {     int a;     float b; };struct aa {     int a;     float b;     struct aa var; };struct aa {     int a;     float b;     struct aa *var; };

🧐 Not the exact question you are looking for?Go ask a question

Solution

The first and third structures are correct.

The first structure is a simple structure with two members, an integer 'a' and a float 'b'.

The third structure is also correct because it includes a pointer to its own type, which is allowed in C. This is often used to create linked lists and trees.

The second structure is incorrect because a structure cannot contain an instance of itself. This would create an infinite loop of structures within structures, which is not allowed. However, a structure can contain a pointer to an instance of itself, as shown in the third structure.

This problem has been solved

Similar Questions

Which of the following structure declaration will throw an error?Question 32Select one:struct temp{}s; main(){}struct temp{}; struct temp s; main(){}struct temp s; struct temp{}; main(){}None of the mentioned

Multi Choice Type QuestionWhich of these is the correct way to declare a structure variable after defining a structure in C?Marks : 1Negative Marks : 0Answer herestruct point p1, p2;point struct p1, p2;struct point = {p1, p2};point p1, p2;

How do you declare a structure in C?struct { int a; float b; } myStruct;struct myStruct { int a, float b};struct myStruct { int a; float b; };struct myStruct int a; float b; myStruct;struct { int a; float b; };

Multi Choice Type QuestionWhat is the primary difference between a structure and a union in C?Marks : 1Negative Marks : 0Answer hereStructure allows nested membersUnion allows nested membersStructure does not allows multiple membersUnion allows only one active memberClearPrev

Which of the following statements about structs is not true:Group of answer choicesThe components in a struct can reuse component names used in other structs, provided there are no duplicate names at the same level in any particular structStructs can only contain named variables, and cannot include arraysIf an array of structs is declared, each element in that array will have all of the properties of the struct type that is the array's base typeWhole structs can be assigned via the assignment operator A=B, provided that A and B are of the same typeIf an array of structs is declared, and a integer buddy variable is then required, the buddy variable can be combined with the array as part of a larger "everything together" struct that is a single compound object

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.