Monday, March 7, 2011

Find the Max Value for Datatypes

/* This is independent of all Platforms */

int main()
{

printf("Max Char is %d",(char)((unsigned char )~0 >> 1));
printf("\nMax short int is %d",(short int)((unsigned short int )~0 >> 1));
printf("\nMax long int is %d",(long int)((unsigned long int )~0 >> 1));
return 0;
}

No comments:

Post a Comment