一个例子教给你C语言的基本组成

举报
CodeAllen 发表于 2021/10/29 23:47:58 2021/10/29
【摘要】 我是Allen,我的公众号是【CodeAllen】,关注回复【1024】获取资源,程序员技术交流①群:736386324 C语言虽然内容比较多,但是其基本成分其实不多的,其他编程语言也都类似,所以就借着一个最简单的例子梳理下C语言的基本成分 #include <stdio.h> int main() { /...

我是Allen,我的公众号是【CodeAllen】,关注回复【1024】获取资源,程序员技术交流①群:736386324

C语言虽然内容比较多,但是其基本成分其实不多的,其他编程语言也都类似,所以就借着一个最简单的例子梳理下C语言的基本成分


      #include <stdio.h>
      int main()
      {
     	/*_some_comments_*/
     	printf("Hello_World!");
     	getch();
     	return 0;
      }
  
 

下面是逐句分析

 

#include <stdio.h>
 

This command includes standard input output header file(stdio.h) from the C library before compiling a C program

在编译C程序之前,此命令包括C库中的标准输入输出头文件(stdio.h)

 

int main()   

 

It is the main function from where C program execution begins.

它是C程序开始执行的主要功能。

 

{

 

Indicates the beginning of the main function.

指示主要功能的开始

 

/*_some_comments_*/    

 

Whatever written inside this command “/*   */” inside a C program, it will not be considered for compilation and execution.

无论在C程序中将此命令写在“ / * * /”命令中的内容如何,都不会考虑对其进行编译和执行。

 

printf("Hello_World!"); 

 

This command prints the output on the screen.

此命令在屏幕上打印输出。

 

getch();    

 

This command is used for any character input from keyboard.

该命令用于从键盘输入的任何字符。

 

return 0;   

 

This command is used to terminate a C program (main function) and it returns 0.

该命令用于终止C程序(主函数),并返回0。

 

}    

 

It is used to indicate the end of the main function.

用于指示主要功能的结束。

文章来源: allen5g.blog.csdn.net,作者:CodeAllen的博客,版权归原作者所有,如需转载,请联系作者。

原文链接:allen5g.blog.csdn.net/article/details/116406749

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。