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



declare an array of structure where the members of the structure are integer variable float variab..

Answer / 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

More C++ General Interview Questions

Is c++ a high level language?

1 Answers  


sir there is some problem with nokia5130c-2,when we are trying to upload movies from net then there is a error occurred"FORMAT NOT SUPPORTED" bt its all ready in 3gp format.please tell me what i do now?

2 Answers   Nokia,


Give an example of run-time polymorphism/virtual functions.

1 Answers  


Is there any problem with the following: char *a=NULL; char& p = *a;?

1 Answers  


What is a modifier in c++?

1 Answers  


What is a c++ class?

1 Answers  


Explain the use of this pointer?

1 Answers  


Explain stack unwinding.

1 Answers  


Is there any difference between int [] a and int a [] in c++?

1 Answers  


Explain "const" reference arguments in function?

1 Answers  


What is the type of 'this' pointer? When does it get created?

1 Answers  


What do you mean by abstraction in C++?

1 Answers  


Categories