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


Please Help Members By Posting Answers For Below Questions

What is the latest version on c++?

1206


Can union be self referenced?

1266


daily Routine of father

1484


How c functions prevents rework and therefore saves the programers time as wel as length of the code ?

1164


What character terminates all character array strings a) b) . c) END

1394