This sample code is for testing some data type border value using C union. Worked on Linux OS.

#include
#include

int main(void)
{
union
{
unsigned long int lms;
unsigned short shms[2];
unsigned char  bms [4];
} myms;

myms.lms = 0;

while (1)
{

printf(“long: %ld  short: %d  byte: %d\n”, myms.lms, myms.shms[0], myms.bms[0]);
usleep(900);
myms.lms++;
}
return 0;
}

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2012 CodeEase.com Suffusion theme by Sayontan Sinha