How to define a structure, C/C++ Programming

Assignment Help:

How to Define a Structure?

Structure declarations are rather more complicated than array declarations, ever since a structure must be defined in terms of its individual members. Generally the composition of a structure may be defined as

struct tag
{
member 1;
member 2;
member m;
} g;

In this declaration struct is a necessary keyword tag is a name that identifies structures of this kind (structures having this composition) and member 1, member 2, . . . , member m are individual member declarations.

The individual members are able to be ordinary variables, arrays, pointers or other structures. The member names within a particular structure should be distinct from one another, though a member name is able to be the same as the name of a variable that is defined outside of the structure. A storage class but can't be assigned to an individual member, and individual members can't be initialized inside a structure type declaration. Formerly the composition of the structure has been defined individual structure type variables can declare as follows.

storage-class struct tag variable 1, variable 2,..., variable n;

where
storage-class is an optional storage class specifier,
struct is a required keyword,
tag is the type name that is used in the structure declaration,
variable 1, variable 2,...., variable n are structure variables of type tag


Related Discussions:- How to define a structure

Pointer declaration for data member, P o i n t e r d e ...

P o i n t e r d e c l a r a t i o n f o r d a t a m e m b e r : M e t h o d 1 : i n t M : : * p x ; / / T h i s

Write a c program to add two complex numbers, #include stdio.h   struct  c...

#include stdio.h   struct  complex   {   float real;   float imag;   };   struct complex complexadd(struct complex,struct  complex);   void main()     {          Date: 26

Should i call a destructor explicitly on a local variable?, Should I call a...

Should I call a destructor explicitly on a local variable?

Copy constructor, What is copy constructor? describe the concept of copy co...

What is copy constructor? describe the concept of copy constructor.

When should i use references, A: Use references when you can use, and use p...

A: Use references when you can use, and use pointers when you have to. References are generally preferred over pointers whenever you don't require "reseating". Usually this mean

I want vlc pitch changing addon, I want VLC Pitch Changing Addon Project...

I want VLC Pitch Changing Addon Project Description: Required: Plugin to modify the pitch of running tracks in VLC without changing the speed. Skills required are C Progra

What is your reaction to following line of code? , Q-What is your reaction ...

Q-What is your reaction to following line of code?               delete this; A: This is not a good programming Practice. A good programmer will insist that you must absolute

Demonstration using moss open source machine translation, Demonstration usi...

Demonstration using Moss Open Source Machine Translation Project Description: Moses is an open source Statistical Machine Translation System. I need someone to provide me a d

Decode the given code, write c++ program to decode the given code. in mobil...

write c++ program to decode the given code. in mobile keypad the integers from 1 to 9 will display the characters from a to z and 0 will assign a space

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