Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Structure

1 view
Skip to first unread message

sanjidur095423

unread,
Mar 29, 2010, 5:09:51 AM3/29/10
to
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.

Ali Karaali

unread,
Mar 29, 2010, 7:24:44 AM3/29/10
to
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

Ali Karaali

unread,
Mar 29, 2010, 7:26:43 AM3/29/10
to
On 29 Mart, 14:24, Ali Karaali <ali...@gmail.com> wrote:
> 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.

paul

unread,
Mar 29, 2010, 7:46:00 AM3/29/10
to

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

http://en.wikipedia.org/wiki/Struct_(C_programming_language)

0 new messages