1.

Explain struct in C.

Answer»

In C, a struct (or structure) is simply a collection of variables (of many types) under a single name. In order to create structure variables, you must first define their data type. When you define a struct, you use the keyword struct.

Syntax:

struct struct_name
{
data_type 1member;
data_type 2member;
...
};

Example:

struct Scaler
{
int emp_id;
char name[60];
char position[90];
float salary;
};


Discussion

No Comment Found