Freelancer job part time jobs

InstaForex
  • Home
  • Jobs hiring now
  • FAQ
  • Contact

Structures in C programming language

January 9, 2011 by Freelance Leave a Comment

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Google+ (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • More
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pocket (Opens in new window)
  • Click to email this to a friend (Opens in new window)
  • Click to print (Opens in new window)

Now we have to learn about classes. But it is better to get an overture of structure before knowing the classes. When we accumulate dissimilar variables having unlike types by giving them one name then it is called Structure. It is trouble-free and mostly used in database programming.

The syntax of structure is given here:

struct Tag {
  Members
};

Tag is used for structure. For making one structure, the format is written here:

Tag name_of_single_structure;

In order to contact a variable in the structure, you have to write the given pattern:

name_of_single_structure.name_of_variable;
For instance:

struct example {
  int y;
};

Example an_example; //taking it as a common variable type
an_example.y = 33;

Another example is given here:

struct database {
  int id_number;
  int age;
  float salary;
};

int main()
{

database employee; //Now it has an employee variable that has changable
// variables inside it.

  employee.age = 23;
  employee.id_number = 2;
  employee.salary = 120570.21;
}

Here database is consists of 3 variables which are id_number, age and salary. It is possible for you to perform various functions with this database. You can bring into play it as variable type. Even you cam make a worker. Then you can give information about worker, in order to bring change. It is also possible to get back structures from functions. Example is given here:

database fn();

Another thing which is similar to structures is unions. The difference is that the whole family of variables has to use one similar memory. When we announce a union then compiler allots a wide range of memory for union. It is a gigantic storage area which restricts you to either use bulky items or the miniatures. But it is not allowed to store different size of data in one memory/
Last but not least, if it is necessary for you to create pointer for getting data that is saved in the mentioned structure, you have to write ->. Even now, all the steps related to pointer are applied.
For instance:

#include <iostream>

using namespace std;

struct xampl {
  int y;
};

int main()
{  
  xampl structure;
  xampl *ptr;
 
  structure.y = 12;
  ptr = &structure;         // It is true that you have to think about the & when     dealing with structures
         
                   
  cout<< ptr->y;             // The -> acts a bit like the * when used with pointers

                                       //   take whatever is at that memory address
                    //  Not "get what that memory address is"
  cin.get();                    
}


  cin.get();                    
}

100% Bonus

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Google+ (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • More
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pocket (Opens in new window)
  • Click to email this to a friend (Opens in new window)
  • Click to print (Opens in new window)
Singly linked lists in C++ programming language
Inheritance Syntax in C++ programming language
Basic lesson for C++ programming language
Using Variables
Binary Trees in C++ programming language – part 1
Templates and Templated Classes in C++ programming language
An introduction to pointers
PHP Variables – php tutorial
Control Structures in PHP language
Inheritance in C++ programming language
Strings in C programming language
Functions in C++ programming language
The C Preprocessor in C++ programming language

Filed Under: C++

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

CAPTCHA
Refresh

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Earn money as trader

Earn from home ads

Work from home ads

Work from home as instaforex forex trader

HF Social

Freelance categories

  • Earn money as webmaster
    • Advertising
    • Affiliate program
    • Amazon
    • Bidvertiser
    • Blogging
    • Facebook
    • Google Adsense
    • Hosting
    • Komoona
    • LinkedIn
    • Neteller
    • SEO
    • Skrill Moneybookers
    • Twitter
  • Education
    • How to do
    • Job description glossary
    • Wordpress how to do
  • Freelancer advice tips
    • Forex trading from home
      • Affiliate programs
        • 500affiliates
        • Avapartner
        • Etoropartners affiliate program
        • HotForex Affiliate program HFaffiliates
      • Binary options trading
        • Anyoption
        • OptionBit Review
        • TradeRush
        • Ubinary
        • Yesoption
      • Facebook IPO price – buy facebook stock
      • Forex brokers reviews
        • 4XP Review
        • Alpari Russia Review
        • Alpari UK
        • AvaTrade Review
          • AvaFx Review
        • DeltaStock Review
        • Directfx Review
        • DukaScopy Review
        • Easy Forex Review
        • Etoro Review
        • ETX Capital Review
        • Exness
        • Forex.com Review
        • Forex4you
        • ForexYard Review
        • FXCM Review
        • FXDD Review
        • FxOpen Review
        • Fxpro Review
        • HiWayFX review
        • Hotforex Review
        • HY Markets Review
        • IC Markets Forex Review
        • IFC Market
        • IForex Review
        • IG Markets
        • Instaforex Review
        • Ironfx Review
        • Keystock Review
        • LCG review
        • Liteforex broker
        • Marketiva Review
        • Markets.com Review
        • NordFx Review
        • Pepperstone Review
        • Plus500 review
        • Roboforex
        • SwissQuote Bank Review
        • Thinkforex
        • UFX Markets review
        • Windsor Brokers Review
        • XeMarkets Review
        • xForex
        • Xtrade Review
        • Youtrade FX Review
        • Zulutrade Review
    • Freelance glossary
    • Freelance Programming tips
    • Learn about programming
      • C++
      • Linux
      • PHP
      • Ruby on rails
      • SQL
    • Top freelance websites
    • Web Design tips
    • Work from home business
    • Writing tips
  • Freelancer job news
    • Job advice
    • Thinking
    • Worldwide job offers
  • IT news
  • Jobs

Best Forex Brokers Reviews

  • Avafx Review – how to earn in forex market using Avafx Forex Broker
  • Avatrade Review
  • eToro Review
  • Alpari NZ Review
  • InstaForex Review
  • DukaScopy Review – Swiss bank Forex broker
  • Forex.com Review – how to earn money in forex market as trader
  • Ironfx Review
  • FXCM Review
  • FxOpen Review
  • Hotforex Review
  • Markets.com Review
  • UFX Markets Review
  • Zulutrade Review – earn money using free forex signals where forex experts trade for you
  • Exness forex broker Review
  • Fxpro Review
  • LiteForex forex broker review
  • NordFx Review and bonus
  • Roboforex forex broker Review
  • XM.com Review - Xemarkets forex broker review

Navigation

  • Home
  • Jobs hiring now
  • FAQ
  • Contact

Languages

  • Arabic language
  • Bengali language
  • Communiqué de presse
  • China language
  • Pressemitteilung
  • Japanese language
  • Comunicado de imprensa
  • Russian language
  • Presione soltar
  • Turkish
  • Comunicato stampa
  • Hindi language

Recent articles

  • IronFX Review
  • How to earn money as freelancer ?
  • LCG broker Review
  • Forex vs. stocks – Which is a Better for Trading ?
  • Thinkmarkets Review
Freelancer job - Copyright 2007
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.