Minggu, Juni 15, 2014

Define Value of int Integer Variable on C Programming Language

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

Example of program of define int integer variable typed signed:

main()
{
  signed int var_int_signed_minimum;
  signed int var_int_signed_maximum;
  var_int_signed_minimum = -2147483648;
  var_int_signed_maximum = 2147483647;
  printf("%d\n", var_int_signed_minimum);
  printf("%d", var_int_signed_maximum);
  getch();
}


Contoh program pendefinisian variabel integer int tipe unsigned:

main()
{
  unsigned int var_int_unsigned_minimum;
  unsigned int var_int_unsigned_maximum;
  var_int_unsigned_minimum = 0;
  var_int_unsigned_maximum = 4294967295;
  printf("%u\n", var_int_unsigned_minimum);
  printf("%u", var_int_unsigned_maximum);
  getch();
}



0 komentar: