answersLogoWhite

0


Best Answer

I don't really get your question, so I give you an example for nested structure:

struct inner1 {
int i;
char c;
};

struct outer {
int i;
char c;
struct inner1 n1;
struct {
int i;
char c;

} n2;

};

valid members for a 'struct outer' type variable are:
.i, .c, .n1.i, .n1.c, .n2.i, .n2.c

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: All members of nested structures must be structure variables?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Why structure variables cannot be compared?

They can be compared with memcmp, but you should be careful if your structures contain:- pointers- alignment gaps- numeric variables (byte order!)- nested structures/unions


What are nested structures in C?

Structures can contain other structures as members; in other words, structures can nest. Consider the following two structure types: struct first_structure_type { int member_of_1; }; struct second_structure_type { double double_member; struct first_structure_type first_struct_member; }; The first structure type is incorporated as a member of the second structure type. You can initialize a variable of the second type as follows: struct second_structure_type second_struct_member; second_struct_member.double_member = 12345.6789; second_struct_member.first_struct_member.integer_member_of_1 = 5; The member operator . is used to access members of structures that are themselves members of a larger structure. No parentheses are needed to force a special order of evaluation; a member operator expression is simply evaluated from left to right. In principle, structures can be nested indefinitely. Ref: http://www.crasseux.com/books/ctutorial/Nested-structures.html


What are nested structures?

Nested structures means we can have a structure inside another eg: struct A { ........... ............ struct B { ........ ........ }b; }a;


When do You use a nested selection structure?

you need nothing


Does break statement terminate only the inner loop in c?

Yes. Break terminates only the innermost control structure, loop, switch, etc. If you want to break out of nested control structures, you can set a variable to induce a second break, or you can throw an exception.

Related questions

Why structure variables cannot be compared?

They can be compared with memcmp, but you should be careful if your structures contain:- pointers- alignment gaps- numeric variables (byte order!)- nested structures/unions


What are nested structures in C?

Structures can contain other structures as members; in other words, structures can nest. Consider the following two structure types: struct first_structure_type { int member_of_1; }; struct second_structure_type { double double_member; struct first_structure_type first_struct_member; }; The first structure type is incorporated as a member of the second structure type. You can initialize a variable of the second type as follows: struct second_structure_type second_struct_member; second_struct_member.double_member = 12345.6789; second_struct_member.first_struct_member.integer_member_of_1 = 5; The member operator . is used to access members of structures that are themselves members of a larger structure. No parentheses are needed to force a special order of evaluation; a member operator expression is simply evaluated from left to right. In principle, structures can be nested indefinitely. Ref: http://www.crasseux.com/books/ctutorial/Nested-structures.html


What are nested structures?

Nested structures means we can have a structure inside another eg: struct A { ........... ............ struct B { ........ ........ }b; }a;


Is there any difference between programming structures and having a structured program?

In a structured program, any structure can be nested within another structure.


Can a if-then-else structure be nested?

Yes.


When do You use a nested selection structure?

you need nothing


How do you do nested strcutres program in c plus plus?

As its name suggests, a nested structure is a structure which contains another within it. Here is an example in which the "nApple" structure is nested withing the "nTree" structure: #includestruct nApple{int stem;int skin;};struct nTree{int leaves;nApple redDelicious;nApple grannySmith;};


What is the definition of 'nested' in C programming?

In C a structure within a structure is called nested. For example, you can embed a while loop in another while loop or for loop in a for loop or an if statement in another if statement.


Why doesn't C have nested functions?

Nested functions are used in some languages to enclose multiple functions and variables into a container so that individual function and variable are not seen from outside. In,C this can be done by putting such functions in a seperate source file.


Does break statement terminate only the inner loop in c?

Yes. Break terminates only the innermost control structure, loop, switch, etc. If you want to break out of nested control structures, you can set a variable to induce a second break, or you can throw an exception.


Can structures be nested in c?

yes. struct a { int x; int y; } struct b{ int z; struct a w; }


What is an included IF function in which the action to be taken for the true or false case includes yet another IF function?

You insert the second IF function into the first one, creating what is called a nested If. Another IF can be put in the True or False part of an existing IF function. In as situation where there is a need for another IF when the first condition is true, the structure could then be something like this:=IF(condition, IF(condition, true, false), false))Note there are two brackets at the end, closing the two IF functions.