【鹏哥C语言】第一讲:C语言的常见概念

Artificial-Fool Lv3
学vs2022

vscode - 编辑器,装插件搭建C/C++环境,上手成本高;

vs2022 - IDE,集成开发环境。

学C
  1. int:指返回时返回一个整数
1
2
3
4
int main()
{
return 0;
}

*整个项目有且仅有一个main函数,即使有多个c文件;

*main 函数可以有参数,其参数有特殊意义;

  1. 单引号括起来的叫字符,双引号括起来的叫字符串printf详情
1
2
3
4
5
6
7
8
9
10
int main()
{
printf("%s\n","haha");//%s 打印字符串
printf("%d\n",100);//%d 打印整数
printf("%c\n",'q');//%c 打印字符
printf("%f\n",3.141);//%f 打印浮点数
printf("%lf\n",3.141);//%lf 打印双精度浮点数

return 0;
}
  1. #include <stdio.h>

    std - standard 即c语言标准库

    i - input

    o - output

  2. ASCII字码表

1
2
3
4
5
6
int main()
{
printf("%c\n", 'a');//a
printf("%c\n", 97);//a
return 0;
}
  1. 循环

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    //打印可见字符
    int main()
    {
    for (int i = 32;i < 127;i++)
    {
    printf("%c ", i);
    if (i % 16 == 15) {
    printf("\n");
    }
    }
    return 0;
    }
  2. 字符串的结束标志为’\0

  • Title: 【鹏哥C语言】第一讲:C语言的常见概念
  • Author: Artificial-Fool
  • Created at : 2024-12-20 15:20:16
  • Updated at : 2024-12-22 20:24:41
  • Link: https://space.bilibili.com/636023121/2024/12/20/PenggeC-note1/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments
On this page
【鹏哥C语言】第一讲:C语言的常见概念