+2 votes
in Class 11 by kratos

Write the different methods of structure initialization.

1 Answer

+6 votes
by kratos
 
Best answer

A struct variable can be initialized, like any other data variables in C++, at the time it is declared. We could use:

struct student

{

char name[20];

int regno;

float fees;

}

s1 = {“ram”, 25,24000.50};

or

student s1 = {“ram”, 25,24000.50};

...