C语言:2.1

int main()
{
    char zi='A';
    short bla=10;
    int blb=20;
    long blc=30;
    float bld=340.56;
    double ble=34.3243;
    printf("%c  %d   %d    %d       %f     %lf\n",zi,bla,blb,blc,bld,ble);
    printf("%d  %d   %d    %d       %d     %d\n",sizeof(zi),sizeof(bla),sizeof(blb),sizeof(blc),sizeof(bld),sizeof(ble));
    printf("%10c  %10d   %10d    %10d       %10f     %10lf\n",zi,bla,blb,blc,bld,ble);
    printf("%10d  %10d   %10d    %10d       %10d     %10d\n",sizeof(zi),sizeof(bla),sizeof(blb),sizeof(blc),sizeof(bld),sizeof(ble));
    printf("%-10d  %-10d   %-10d    %-10d       %-10d     %-10d\n",sizeof(zi),sizeof(bla),sizeof(blb),sizeof(blc),sizeof(bld),sizeof(ble));
    getchar();

}

数据类型长度,%10d,%-10d理解

posted @ 2021-03-30 16:14  myrj  阅读(79)  评论(0编辑  收藏  举报