Knowee
Questions
Features
Study Tools

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

Question

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

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

Solution

The structure declaration that will throw an error is:

struct temp s; struct temp{}; main(){}

The reason is that the structure 'temp' is used before it is defined. In C/C++, a structure must be defined before it can be used.

Similar Questions

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; };

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; };

Choose a correct statement about C structures.Question 29Select one:Structure elements can be initialized at the time of declaration.Only integer members of structure can be initialized at the time of declaration.Structure members can not be initialized at the time of declarationNone of the above

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

Identify the incorrect syntax for a pointer to a structure:Assuming the structure: struct temp { int b; } *obj;

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.