raghu said:
i am new to c language i come across some definitions like unsigned int
long int32 i want to know why such assignments are mentioned and what
does it mean?
I guess you came across:
typedef unsigned long int u_int32;
It means that now you can declare variables like this:
u_int32 i;
and it will mean exactly the same as:
unsigned long int i;
As to why someone would want to do this, there are several answers: to
save typing
; to tell the reader that the variable is 32 bits and unsigned.
Both of these are IMO wrong, and here's why:
The `unsigned long` type may not be 32 bits on all
implementations/architectures, so you'd actually introduce subtle bugs
if you relied on the new type name alone. You've just made your program
not portable.
Saving on typing is no saving really. You only type once, but the code
is read many times, and by various people. For the readers, it may be
more useful, and possibly safer as I described above, to know exactly
what you're doing.
BTW, the C standard provides for a way to specify exact width. Have a
look at <stdint.h> header for your implementation. The type names are
of the form `
intN_t` where `u` siginfies unsigendness, and N is the
width in number of bits.