Explain structures, C/C++ Programming

Assignment Help:

Structures

A structure is a derived data type. It is a combination of logically related data items. Unlike arrays, which are a collection of such as data types, structures can be made of members of unlike data type. The data items in the structures usually belong to the same entity, like information of an employee, players etc.

The general format of structure declaration is:

struct tag

                 {

                                type member1;

                                type member2;

                                type member3;

                                :

                                :

}variables;

We can omit the variable declaration in the structure declaration and explain it separately as follows :

struct tag variable;

In C++ we can omit struct and simply write :

tag variable;

e.g.

Structure definition.

                struct account

                 {

                                int accnum;

                                char acctype;

                                char name[25];

                                float balance;

                 };

 

Structure declaration.

struct account oldcust; [or]

account newcust;

We can refer to the member variables of the structures by using a dot operator (.).

 


Related Discussions:- Explain structures

Explain the symbolic constants in c language, Explain the Symbolic Constant...

Explain the Symbolic Constants in c language? Symbolic constants are the constants of any type that declared by using the #define compiler directive and it is a preprocessor di

We are seeking someone to search mp3 link, Project Description: We are s...

Project Description: We are seeking someone to search mp3 link form audio or m3u8 for videos. Skills required are .NET, C Programming, Engineering, C# Programming

Illustration of plot function, Illustration of Plot function: To be mo...

Illustration of Plot function: To be more common, the script could prompt the user for the time and temperature, instead of just assigning the values. Then, the axis function

C program to returns the string, Program is to take two arguments and retur...

Program is to take two arguments and returns the string: Program is to take two arguments and returns the string which is larger the larger string has larger ascii value invok

C language, in a program for what purpose print f and scan f is used

in a program for what purpose print f and scan f is used

What is the difference among a pointer and a reference?, A: A reference has...

A: A reference has to always refer to some object and, so, must always be initialized; pointers do not have such limits. A pointer may be reassigned to point to distinct objects wh

Write down the class listnode, Question: (a) Write down the class 'Li...

Question: (a) Write down the class 'ListNode' to contain the following:- (i) variable data of type Object (ii) variable next of type ListNode (iii)

File Input and Output, Given a bool variable isReadable write some statem...

Given a bool variable isReadable write some statements that assign true to isReadable if the file "topsecret" exists and can be read by the program and assigns false to isR

Explain automatic variables, Automatic Variables Automatic variables ar...

Automatic Variables Automatic variables are variable which are explained within the functions. They lose their value when the function terminates. It can be accessed only in th

I need app design team wanted to new check-in app, New App Production compa...

New App Production company is seeking an organized and highly accomplished design team to prepare the first (and potentially more) of my companies' App concepts, intended completel

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd