Friday, August 7, 2009

STRUCTURES

WE have seen variables of simple data types such as float ,char and int variables of such types represent one item of information.But just an eggs are organized in to eggs,employees in to departments.It ogten convenient to organize simple variables in to more complex entities.The C++ constrution called the structure is one way to do this a structure is a collection of simple variables.The variables in a structure can be differnt types .Some can be int some can be float and so on.The data items in a structure are called the members of the structure,For c++ programmers structures are ne of the two important building blocks in the understanding of the objects and classes.
syntax of the structure:
struct or Tag
{
datatype membername1;
datatype member2;
};
Defining a structure variable is the same as that for defining a built in datatype such int(in c you need to include the keyword struct in structure definatiions as in c++ keyword struct is not necessary).

No comments:

Post a Comment