See questions 2.12 and 2.13 in the comp.lang.c FAQ,
The compiler is obviously putting in 3 padding bytes after the
'abc' element of the structure. It does that to make sure when
you create an array of such structures all the structures of
the array end up on correctly aligned memory positions. If
it wouldn't do that something simple as
my_dev xxx[ 2 ];
xxx.abc = 'c';
could lead to a crash of the program, at least on your machine
(on mine the sizeof for the structure is repoted as 1, so on
my machine it doesn't seem necessary to insert padding bytes).
For the same reason also padding bytes can appear between the
elements of a structure.
Actually, I can't think of any good reason why the compiler *needs* to
pad "struct my_dev" to 4 bytes. It *could* internally treat a
structure with a single member the same way it would treat an object
of the member type.
There is a requirement for all pointers to structures to have the same
representation; on an implementation where byte pointers and word
pointers are represented differently, that could force 4-byte
alignment for all structures, even small ones. But most systems use
the same representation for all pointers.
Probably the compiler's developers decided that it would be simpler to
force all structures to be word-aligned (where a "word" is probably 4
bytes). They're allowed to do that. The standard allows padding
after members of structures; it doesn't require that padding to be the
minimum necessary. A perverse implementation could add as much
padding as it likes, for no good reason at all.
[...]
For your particular problem, why do you need a structure at all?
Rather than
struct my_dev {
char abc;
};
why not just use type char directly (with a typedef if you like)?
(Using a structure does have the advantage of type safety; "struct
my_dev" is incompatible with other types. But then you have to pay
the price of letting the compiler add extra padding.)