数の上限・下限

  1. Sample#1
    1. Program
      /*
        Program    : numvalue-1.c
      */
       
      #include <stdio.h>
      
      int main(){
        int i;
      
        i=7;
        printf("i = %09x\n",i);  
        i=-7;
        printf("i = %09x\n",i);  
        return(0);
      }
    2. Result
      i = 000000007
      i = 0fffffff9
       
  2. Sample#2
    1. Program
      /*
        Program    : numvalue-2.c
      */
       
      #include <stdio.h>
      
      int main(){
      
        int i, j;
      
        i=7; j=0x7;
        puts("i=7; j=0x7;");
        printf("(Hex) i = %09x, j = %09x\n",i,j);  
        printf("(Dec) i = %09d, j = %09d\n",i,j);  
      
        i=12; j=0xc;
        puts("i=12; j=0xc;");
        printf("(Hex) i = %09x, j = %09x\n",i,j);  
        printf("(Dec) i = %09d, j = %09d\n",i,j);  
      
        i=-1; j=0xffffffff;
        puts("i=-1; j=0xffffffff;");
        printf("(Hex) i = %09x, j = %09x\n",i,j);  
        printf("(Dec) i = %09d, j = %09d\n",i,j);  
      
        return(0);
      }
    2. Result
      i=7; j=0x7;
      (Hex) i = 000000007, j = 000000007
      (Dec) i = 000000007, j = 000000007
      i=12; j=0xc;
      (Hex) i = 00000000c, j = 00000000c
      (Dec) i = 000000012, j = 000000012
      i=-1; j=0xffffffff;
      (Hex) i = 0ffffffff, j = 0ffffffff
      (Dec) i = -00000001, j = -00000001


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2015-05-14 (木) 13:32:39 (1622d)