当前位置:网站首页>C中main函数的几种写法
C中main函数的几种写法
2022-07-01 20:20:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
1、最标准的写法
#include <stdio.h>
int main()
{
printf("Hello World! ");
return 0;
}2、把int 换成void
#include <stdio.h>
void main()
{
printf("Hello World! ");
return 0;
}3、不写int
#include <stdio.h>
main()
{
printf("Hello World! ");
return 0;
}4、不写return
#include <stdio.h>
int main()
{
printf("Hello World! ");
}以上四种写法均成功运行。
多种写法不报错的原因
- C语言最早的时候只是一种规范和标准(例如C89, C11等)
- 标准的推行需要各大厂商的支持和实施
- 而在支持的实施的时候由于各大厂商利益、理解等问题,导致了实施的标准不同,发生了变化
- Turbo C
- Visual C(VC)
- GNU C(GCC)
- 所以大家才会看到不同的书上书写的格式有所不同, 有的返回int,有的返回void,有的甚至没有返回值
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/147183.html原文链接:https://javaforall.cn
边栏推荐
- MySQL数据库驱动(JDBC Driver)jar包下载
- Practical project notes (I) -- creation of virtual machine
- 芭比Q了!新上架的游戏APP,咋分析?
- 300 linear algebra Lecture 4 linear equations
- 目标检测——Yolo系列
- Is it safe to open an account online? Can a novice open a stock trading account.
- [multithreading] lock strategy
- 安装mysql时出现:需要这两个包perl(Data::Dumper),perl(JSON)
- 开环和闭环是什么意思?
- 杰理之、产线装配环节【篇】
猜你喜欢
![[multithreading] lock strategy](/img/97/5cacfd2de73d3c3b8acabf6b5c5ce3.png)
[multithreading] lock strategy

Entering Ruxin Town, digital intelligence transformation connects "future community"

How to connect the two nodes of the flow chart

天气预报小程序源码 天气类微信小程序源码

Learn white box test case design from simple to deep

tensorflow 张量做卷积,输入量与卷积核维度的理解

目標檢測——Yolo系列

杰理之、产线装配环节【篇】

STC 32-bit 8051 single chip microcomputer development example tutorial II i/o working mode and its configuration

【Opencv450】HOG+SVM 与Hog+cascade进行行人检测
随机推荐
Write blog documents
多个张量与多个卷积核做卷积运算的输出结果
喜马拉雅自研网关架构演进过程
从20s优化到500ms,我用了这三招
Comprehensive evaluation and detailed inventory of high-quality note taking software (I) note, obsedian, remnote, flowus
实战项目笔记(一)——虚拟机的创建
2022熔化焊接与热切割上岗证题目模拟考试平台操作
芭比Q了!新上架的游戏APP,咋分析?
Niuke programming question -- must brush the string of 101 (brush the question efficiently, draw inferences from one instance)
300题线性代数 第四讲 线性方程组
天气预报小程序源码 天气类微信小程序源码
RichView RichEdit SRichViewEdit PageSize 页面设置与同步
Kuberntes云原生实战一 高可用部署架构
新版Free手机、PC、平板、笔记本四端网站缩略展示图在线一键生成网站源码
Importance of EDA tools to chip industry knowledge popularization
随机头像大全,多分类带历史记录微信小程序源码_支持流量主
On the usage of a magic function
以飞地园区为样本,看雨花与韶山如何奏响长株潭一体化发展高歌
leetcode刷题:栈与队列04(删除字符串中的所有相邻重复项)
《軟件工程導論(第六版)》 張海藩 複習筆記