Dear All,
what are __u32, __u16, __u8 ?
how to print ival/ivar ? which type they are ?Code:typedef struct a { __u32 ival; __u16 ivar; }b; b *c; c->ival=3;
Thanks in advance ...
Dear All,
what are __u32, __u16, __u8 ?
how to print ival/ivar ? which type they are ?Code:typedef struct a { __u32 ival; __u16 ivar; }b; b *c; c->ival=3;
Thanks in advance ...
this is unsigned integer type with 8,16,32 bits in it...
you can print them all using %u format
PS. on the 16-bit compiler you may need %lu for the last one as it will be probably typedef of unsigned long...
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
below code showing errors
__u32 undeclared
Code:#include <stdio.h> #include <stdlib.h> int main() { __u32 a; a=12; printf("__u32 a =%lu", a); return 0; }
so you do not have these types defined...below code showing errors
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
Are you needing to work with the
asm/types.h
Header file? As I believe those types are defined within.
Since the names begin with underscores, it means they're specific to whatever system you're using.
So unless you give us more detail, we can't help.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Thanks for all,
These are all system specific and defined in asm/types.h
thanks ...
In some gcc compilers the header file reqd. may be <sys/types.h>
As of C99 there are standard fixed width types. If you include stdint.h then you get int8_t, uint8_t, int16_t, uint16_t, etc. These have at least a fighting chance of being portable, since they're standard C, even if it is the newer, less-implemented standard. I'd recommend using stdint.h if you can, since it's less system-specific than types like __u8.
Of course these types need not exist on systems without the "proper" standard types (say a system with 9-bit bytes), but that would be true for __u8, etc. as well.