AllExperts > Experts 
Search      

C

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More C Answers
Question Library

Ask a question about C
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Mohamed Ameer Irshad.H
Expertise
can ask me questions regarding general concepts,algorithms in C.STLs(c++)TSR programmin,virus writing,basic level of device driver programming(linux),network programmming(UNIX C) ,UNIX shell scripting,grapihcs using TURBO C and a bit of hardware interaction..

Experience
just a student level experience but hav worked out of my academic contexts..

Organizations
Vellore Institute of Technology(University Of VIT)

Publications
Technical Publication Of NACISS(National Conference On Computational Intelligence and Security Systems)

Paper titled REMOTE DESKTOP ACCESS USING MOBILE PHONES AND AN ENHANCEMENT FOR INTRA-MOBILE SEARCH got selected in an international conference SNPD 2008,Thailand.And the paper will be published IEEE Journal by August 2008.

Paper titled REMOTE DESKTOP ACCESS USING MOBILE PHONES AND AN ENHANCEMENT FOR INTRA-MOBILE SEARCH got selected in International Conference on Information and Communication Technologies(ICT 2008) Paris,France.The same will be published in Proceedings of World Academy of Science, Engineering and Technology, Volume 30, July 2008. Education/Credentials
did a few courses in comp institutions in C and a few projects

Awards and Honors
Presented Papers in National Conferences

 
   

You are here:  Experts > Computing/Technology > C/C++ > C > C programing language

Topic: C



Expert: Mohamed Ameer Irshad.H
Date: 5/27/2008
Subject: C programing language

Question
Respected Sir, I would really appreciate if you could tell me how to use Structure in C program about the basic and advance. Oh! please give some examples. Thank you in advice

Answer
structures are used to encapsulate many varialbe of different data types..

every structure has a name,variable and one or more members,
the various variables are called members of the structure..
they r defined under a name.
now these members should be access by some means.so we define structure variables.

the syntax is

struct struct_name
{

     data_type member1;
     data_type member2;
}
to define a structure variable:

struct struct_name variable_name;

to access the members :

variable_name.struct_name;


for example pls go through the following code:

#include<stdio.h>

struct person
{
  char *name;
  int age;
};

int main()
{
  struct person p;
  p.name = "John Smith";
  p.age = 25;
  printf("%s",p.name);
  printf("%d",p.age);
  return 0;
}


here the structure name is person.

the members are *name and age.

the structure varible is p

and they are access as
p.name,p.age


i guess u got a clear picture about structures and their usage..
if ny doubts contact further..


Ameer Irshad

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.