adsense


Tuesday, 24 November 2015

C++ LANGUAGE DEFINING A STRUCTURE

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



C++ LANGUAGE DEFINING A STRUCTURE







Defining a Structure 


To define a structure, you must use the struct statement. The 
struct statement defines a new data type, with more than one 
member, for your program. The format of the struct statement is this: 


struct [structure tag] 
{ 
   member definition; 
   member definition; 
   ... 
   member definition; 
} [one or more structure variables];   


The structure tag is optional and each member definition 
is a normal variable definition, such as int i; or float f; 
or any other valid variable definition. At the end of the 
structure's definition, before the final semicolon, you 
can specify one or more structure variables but it is 
optional. Here is the way you would declare the Book structure:
 
struct Books 
{ 
   char  title[50]; 
   char  author[50]; 
22. DATA STRUCTURES 
   char  subject[100]; 
   int   book_id; 
}book;   


No comments: