Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
9Activity
0 of .
Results for:
No results containing your search query
P. 1
Structures

Structures

Ratings: (0)|Views: 74|Likes:
Published by midhungbabu88

More info:

Published by: midhungbabu88 on Jul 05, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PPT, PDF, TXT or read online from Scribd
See more
See less

09/18/2010

pdf

text

original

 
C structures and unions
(Reek, Ch. 10)
1CS 3090: Safety Critical Programming in C
 
C structures: aggregate, yet scalar
CS 3090: Safety Critical Programming in C2
`
aggregate in that they hold multiple data items at onetime
`
named
members
hold data items of various types
`
like the notion of class/field in C or C++ ²but without the data hiding features
`
scalar in that C treats each structure as a unit
`
as opposed to the ´arraapproach: a pointer to a collection of members in memory
`
entire structures (not just pointers to structures) may bepassed as function arguments, assigned to variables, etc.
`
Interestingly, they cannot be compared using
==
(rationale: too inefficient)
 
S
tructure declarations
CS 3090: Safety Critical Programming in C3
`
Combined variable and type declaration
struct tag {member-list} variable-list;
`
A
ny one of the three portions can be omitted
struct {int a, b; char *p;} x, y; /* omit tag */
`
variables
x, y
declared with members as described:
int
members
a, b
and
char
pointer
p
.
`
x
and
y
have same type, but differ from all others ² even if there is another declaration:
struct {int a, b; char *p;} z;/* z has different type from x, y */

Activity (9)

You've already reviewed this. Edit your review.
1 hundred reads
vinodraghu liked this
pasyantee liked this
AB Vettoor liked this
kalirajagopal liked this
Juni Gultom liked this
JDeepa Priya liked this
pankaj114 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->