美文网首页
《C Primer Plus》读书笔记(第四天)

《C Primer Plus》读书笔记(第四天)

作者: 道别1999 | 来源:发表于2019-07-12 01:29 被阅读0次

今天也是一口气把第三章看完了(=・ω・=),总结起来就是枯燥,把C语言的基本数据类型都讲了

数据与C

- 基本的数据类型

基本数据类型.png

- 类型大小

//程序清单3.8 typesize.c程序——打印类型大小
#include<stdio.h>
int main(void)
{
    printf("Type int has a size of %u bytes.\n",sizeof(int));
    printf("Type char has a size of %u bytes.\n",sizeof(char));
    printf("Type long has a size of %u bytes.\n",sizeof(long));
    printf("Type long long has a size of %u bytes.\n",sizeof(long long));
    printf("Type double has a size of %u bytes.\n",sizeof(double));
    printf("Type long double has a size of %lu bytes.\n",sizeof(long double));

    getchar();
    return 0;
}

-关于printf()

//程序清单3.2 printl.c程序——演示printf()的一些特性
#include<stdio.h>
int main(void)
{
    int ten=10;
    int two=2;

    printf("Doing it right:");
    printf("%d minus %d is %d\n",ten,2,ten-two);
    printf("Doing it wrong:");
    printf("%d minus %d is %d\n",ten);

    getchar();
    return 0;
}

今天完全就是在划水,一来态度有些怠慢偷懒(/ω\),抵挡不住游戏的诱惑(〃ω〃),二来这一章真的讲的很详细,把C用到的数据类型都讲了,不免感觉无聊,可能是我太浮躁了吧
(┬_┬)

相关文章

网友评论

      本文标题:《C Primer Plus》读书笔记(第四天)

      本文链接:https://www.haomeiwen.com/subject/odfskctx.html