answersLogoWhite

0

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

15y ago

What else can I help you with?

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;


Is Union cannot be nested in a structure?

In most programming languages, a union cannot be nested directly within a structure because it can lead to ambiguity in memory allocation and access. However, some languages allow unions to be members of structures, but the union itself should not contain another union directly. The rules can vary between languages, so it’s essential to refer to the specific language's documentation for detailed behavior.


When do You use a nested selection structure?

you need nothing

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.


Is Union cannot be nested in a structure?

In most programming languages, a union cannot be nested directly within a structure because it can lead to ambiguity in memory allocation and access. However, some languages allow unions to be members of structures, but the union itself should not contain another union directly. The rules can vary between languages, so it’s essential to refer to the specific language's documentation for detailed behavior.


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