我的第一个c语言程序hello world

我的第一个c语言程序

  • 什么是C语言

c语言是一种面向过程的计算机编程语言,常用于底层软件开发。

  • 如何写一个c语言程序
  1. 打开vs
  2. 新建一个(空)项目
  3. 新建源文件(xxx.c为源文件 xxx.h为头文件)
  4. .写代码
#include<stdio.h>

int main()
{
	printf("hello world\n");
	return 0;
}

输出结果:
在这里插入图片描述
这是我的第一个c语言代码,功能为输出hello world。

  • 其中int为返回类型为整型,main为函数名(一个工程中main函数有且只有一个)。{…}为函数体,{代表开始,}代表结束
  • printf中print为打印f为函数,printf(“hello world\n”);是把hello world打印到屏幕上是输出操作。
  • 因为printf是库函数( C语言自身提供的函数 ),因此引入头文件#include<stdio.h>,其中std为标准,i 为 input ,o 为 output。stdio为标准输入输出。

猜你喜欢

转载自blog.csdn.net/weixin_46429649/article/details/107889027