Structure

S

sanjidur095423

HI,
My name is Sanjidur,a student of IUT.I've a question that "What is the
structure?".

Any reply will be gratefully appreciated.
Sanjidur095423.
 
A

Ali Karaali

A structure is a special case that you can aggregate types in a single
special type.
For instance;
You need a Student type. Student type consists of a name and a student
ID which
are a string and an integer respectively.
You can aggregate these two types in a single Student type.

int main()
{
struct Student {
char name[20];
int ID;
};

//and you can access these element by using dot . operator.

struct Student student = {Ali, 112};
printf("%s", student.name);
printf("%d", student.ID);
}

Ali
 
A

Ali Karaali

A structure is a special case that you can aggregate types in a single
special type.
For instance;
You need a Student type. Student type consists of a name and a student
ID which
are a string and an integer respectively.
You can aggregate these two types in a single Student type.

int main()
{
 struct Student {
    char name[20];
    int ID;
 };

//and you can access these element by using dot . operator.

 struct Student student = {Ali, 112};

it should be "Ali" obviously.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,103
Messages
2,570,642
Members
47,245
Latest member
LatiaMario

Latest Threads

Top