<s>
A	O
struct	B-Application
in	O
the	O
C	B-Language
programming	I-Language
language	I-Language
(	O
and	O
many	O
derivatives	O
)	O
is	O
a	O
composite	O
data	O
type	O
(	O
or	O
record	O
)	O
declaration	O
that	O
defines	O
a	O
physically	O
grouped	O
list	O
of	O
variables	O
under	O
one	O
name	O
in	O
a	O
block	O
of	O
memory	O
,	O
allowing	O
the	O
different	O
variables	O
to	O
be	O
accessed	O
via	O
a	O
single	O
pointer	O
or	O
by	O
the	O
struct	B-Application
declared	O
name	O
which	O
returns	O
the	O
same	O
address	O
.	O
</s>
<s>
The	O
struct	B-Application
data	O
type	O
can	O
contain	O
other	O
data	O
types	O
so	O
is	O
used	O
for	O
mixed-data-type	O
records	O
such	O
as	O
a	O
hard-drive	O
directory	O
entry	O
(	O
file	O
length	O
,	O
name	O
,	O
extension	O
,	O
physical	O
address	O
,	O
etc	O
.	O
</s>
<s>
The	O
C	B-Language
struct	B-Application
directly	O
references	O
a	O
contiguous	O
block	O
of	O
physical	O
memory	O
,	O
usually	O
delimited	O
(	O
sized	O
)	O
by	O
word-length	O
boundaries	O
.	O
</s>
<s>
It	O
corresponds	O
to	O
the	O
similarly	O
named	O
feature	O
available	O
in	O
some	O
assemblers	B-Language
for	O
Intel	O
processors	O
.	O
</s>
<s>
Being	O
a	O
block	O
of	O
contiguous	O
memory	O
,	O
each	O
field	O
within	O
a	O
struct	B-Application
is	O
located	O
at	O
a	O
certain	O
fixed	O
offset	O
from	O
the	O
start	O
.	O
</s>
<s>
Because	O
the	O
contents	O
of	O
a	O
struct	B-Application
are	O
stored	O
in	O
contiguous	O
memory	O
,	O
the	O
sizeof	B-Language
operator	O
must	O
be	O
used	O
to	O
get	O
the	O
number	O
of	O
bytes	O
needed	O
to	O
store	O
a	O
particular	O
type	O
of	O
struct	B-Application
,	O
just	O
as	O
it	O
can	O
be	O
used	O
for	O
primitives	O
.	O
</s>
<s>
The	O
alignment	O
of	O
particular	O
fields	O
in	O
the	O
struct	B-Application
(	O
with	O
respect	O
to	O
word	O
boundaries	O
)	O
is	O
implementation-specific	O
and	O
may	O
include	O
padding	O
,	O
although	O
modern	O
compilers	O
typically	O
support	O
the	O
#pragma	O
pack	O
directive	O
,	O
which	O
changes	O
the	O
size	O
in	O
bytes	O
used	O
for	O
alignment	O
.	O
</s>
<s>
In	O
the	O
C++	B-Language
language	I-Language
,	O
a	O
struct	B-Application
is	O
identical	O
to	O
a	O
C++	B-Application
class	I-Application
but	O
has	O
a	O
different	O
default	O
visibility	O
:	O
class	B-Application
members	O
are	O
private	O
by	O
default	O
,	O
whereas	O
struct	B-Application
members	O
are	O
public	O
by	O
default	O
.	O
</s>
<s>
The	O
struct	B-Application
data	O
type	O
in	O
C	B-Language
was	O
derived	O
from	O
the	O
ALGOL	B-Language
68	I-Language
struct	B-Application
data	O
type	O
.	O
</s>
<s>
Like	O
its	O
C	B-Language
counterpart	O
,	O
the	O
struct	B-Application
data	O
type	O
in	O
C#	B-Application
(	O
Structure	O
in	O
Visual	B-Language
Basic	I-Language
.NET	I-Language
)	O
is	O
similar	O
to	O
a	O
class	B-Application
.	O
</s>
<s>
The	O
biggest	O
difference	O
between	O
a	O
struct	B-Application
and	O
a	O
class	B-Application
in	O
these	O
languages	O
is	O
that	O
when	O
a	O
struct	B-Application
is	O
passed	O
as	O
an	O
argument	O
to	O
a	O
function	O
,	O
any	O
modifications	O
to	O
the	O
struct	B-Application
in	O
that	O
function	O
will	O
not	O
be	O
reflected	O
in	O
the	O
original	O
variable	O
(	O
unless	O
pass-by-reference	O
is	O
used	O
)	O
.	O
</s>
<s>
This	O
differs	O
from	O
C++	B-Language
,	O
where	O
classes	O
or	O
structs	B-Application
can	O
be	O
statically	B-General_Concept
allocated	I-General_Concept
or	O
dynamically	O
allocated	O
either	O
on	O
the	O
stack	O
(	O
similar	O
to	O
C#	B-Application
)	O
or	O
on	O
the	O
heap	O
,	O
with	O
an	O
explicit	O
pointer	O
.	O
</s>
<s>
In	O
C++	B-Language
,	O
the	O
only	O
difference	O
between	O
a	O
struct	B-Application
and	O
a	O
class	B-Application
is	O
that	O
the	O
members	O
and	O
base	O
classes	O
of	O
a	O
struct	B-Application
are	O
public	O
by	O
default	O
.	O
</s>
<s>
(	O
A	O
class	B-Application
defined	O
with	O
the	O
class	B-Application
keyword	O
has	O
private	O
members	O
and	O
base	O
classes	O
by	O
default	O
.	O
)	O
</s>
<s>
The	O
general	O
syntax	O
for	O
a	O
struct	B-Application
declaration	O
in	O
C	B-Language
is	O
:	O
</s>
<s>
Such	O
a	O
struct	B-Application
declaration	O
may	O
also	O
appear	O
in	O
the	O
context	O
of	O
a	O
typedef	B-Language
declaration	O
of	O
a	O
type	O
alias	O
or	O
the	O
declaration	O
or	O
definition	O
of	O
a	O
variable	O
:	O
</s>
<s>
If	O
an	O
initializer	O
is	O
given	O
or	O
if	O
the	O
object	O
is	O
statically	B-General_Concept
allocated	I-General_Concept
,	O
omitted	O
elements	O
are	O
initialized	O
to	O
0	O
.	O
</s>
<s>
A	O
struct	B-Application
may	O
be	O
assigned	O
to	O
another	O
struct	B-Application
.	O
</s>
<s>
Pointers	O
can	O
be	O
used	O
to	O
refer	O
to	O
a	O
struct	B-Application
by	O
its	O
address	O
.	O
</s>
<s>
This	O
is	O
useful	O
for	O
passing	O
structs	B-Application
to	O
a	O
function	O
.	O
</s>
<s>
The	O
->	O
operator	O
dereferences	O
the	O
pointer	O
to	O
struct	B-Application
(	O
left	O
operand	O
)	O
and	O
then	O
accesses	O
the	O
value	O
of	O
a	O
member	O
of	O
the	O
struct	B-Application
(	O
right	O
operand	O
)	O
.	O
</s>
