Minggu, Juni 15, 2014

Define Value of long int Integer Variable on C Programming Language

As well as short int dan int integer variable, long int integer variable also available typed signed dan unsigned, long int variable typed signed begin from -2147483648 up to 2147483647 with printf code %ld, while long int typed unsigned begin from 0 up to 4294967295 with printf code %lu, where if they are defined out of range value will show false value when program is run.

Example of program of define long int integer variable typed signed:

main()
{
  signed long int var_long_int_signed_minimum;
  signed long int var_long_int_signed_maximum;
  var_long_int_signed_minimum = -2147483648;
  var_long_int_signed_maximum = 2147483647;
  printf("%ld\n", var_long_int_signed_minimum);
  printf("%ld", var_long_int_signed_maximum);
  getch();
}


Example of program of define long int integer typed unsigned:

main()
{
  unsigned long int var_long_int_unsigned_minimum;
  unsigned long int var_long_int_unsigned_maximum;
  var_long_int_unsigned_minimum = 0;
  var_long_int_unsigned_maximum = 4294967295;
  printf("%lu\n", var_long_int_unsigned_minimum);
  printf("%lu", var_long_int_unsigned_maximum);
  getch();
}



0 komentar: