adspace
declare an array of structure where the members of the
structure are integer variable float variable integer array
char variable access all elements of the structure using dot
operator and this pointer operator
Answer Posted / Mudit Kumar Gupta
In C++, you can declare a structure array as follows:n```nstruct MyStruct {n int a;n float b;n int c[10];n char d[20];n};nMyStruct myArray[5]; // Declare an array of 5 structuresnn// Access elements using dot operator:nmyArray[0].a = 10;n// ...nn// Access elements using pointer operator:nMyStruct *p = &myArray[0];np->c[0] = 20;np->d[0] = 'A';
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers