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

C#, 1. write a program named InputMethodDemo2 that eliminates the repetitiv...

1. write a program named InputMethodDemo2 that eliminates the repetitive code in the InputMethod() in the InputMethodDemo program. Rewrite the program so the InputMethod()contains

Define the data file in c programming, Define the Data File in C Programmin...

Define the Data File in C Programming? Many applications needs that information can written to or read from an auxiliary memory device. Such information is stock up on the memo

Program, program to check whether a given point lies inside a rectangle or ...

program to check whether a given point lies inside a rectangle or not

develop a calculator in masm, Part 1 Assignment:  develop a calculator...

Part 1 Assignment:  develop a calculator in MASM. Text chapters covered:  1 through 4, 5.4, 5.5, 6.3, 7.4 You will develop a "calculator" algorithm in MASM using reverse-

Compiler Design - Limit In The Method Instructions, Raj is a newbie to the ...

Raj is a newbie to the programming and while learning the programming language he came to know the following rules: · Each program must start with ''{'' and end with ''}''

Create a software application, Project Description: Currently seeking so...

Project Description: Currently seeking someone who can create me a software application (google chrome crx file_ that will auto add all shoe sizes to cart directly and if not av

Explain protected derivation, Protected derivation In addition to doing...

Protected derivation In addition to doing private and public derivations, you may also do a protected derivation. In this situation :   The private members inherited

Write a recursive function with cylinders, I need to make a fractal trees i...

I need to make a fractal trees in OpenGL C++ . The method used is to write a recursive function with cylinders of different sizes and angles to create the tree trunk and branches.

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