当前位置:网站首页>Understanding of int argc, char * * argv in C language main function
Understanding of int argc, char * * argv in C language main function
2022-06-30 01:21:00 【yscisco】
About c Language main Function int argc,char **argv The understanding of the
c Language main Functions are usually shaped like int main(int argc, char **argv), that argc and argv What does it mean ?
Actually ,argc It means incoming main The number of arguments to the function ; and argv It means incoming main A list of arguments to a function . Of course , Here argc and argv It can be changed to another name , because argc (argument count) and argv(argument vector) It's used a lot , So I suggest you use these two names for your code . in addition ,char ** A pointer representing a carton character pointer . The test code is as follows
#include <stdio.h>
int main(int argc, char **argv)
{
int i=0;
printf("%d\n",argc);
for (i=0;i<argc;i++)
{
printf("%s\n",argv[i]);
}
}
[[email protected] c]# ./a.out arg1 arg2 arg3
4
./a.out
arg1
arg2
arg3
Code after name change
#include <stdio.h>
int main(int count, char **vector)
{
int i=0;
printf("%d\n",count);
for (i=0;i<count;i++)
{
printf("%s\n",vector[i]);
}
}
[[email protected] c]# ./new one two three four
5
./new
one
two
three
four
边栏推荐
- 浅析现代Web端im即时通讯开发技术
- Newton method (optimization of two variable functions)
- [recommended] how to quickly locate a bug during testing
- 在线SQL转CSV工具
- 挖财的课程靠谱吗,让开户安全吗?
- Shell spec date format
- Stimulsoft Reports报告工具,Stimulsoft创建和构建报告
- Wechat applet - requestsubscribemessage:fail can only be invoked by user tap gesture
- Live broadcast configuration of crmeb knowledge payment system program configuration (method 2)
- 传统微服务框架如何无缝过渡到服务网格 ASM
猜你喜欢

如何统一项目中包管理器的使用?

【535. TinyURL 的加密与解密】

Stimulus reports reporting tool, stimulus creates and builds reports
![[Thesis Writing] English thesis writing guide](/img/59/88d34814a88a2da19ed6a236825649.png)
[Thesis Writing] English thesis writing guide

Crmeb SMS for program configuration of knowledge payment system

我,33岁,字节跳动测试开发,揭开北京“测试岗”的真实收入

浅析现代Web端im即时通讯开发技术

作文总写不好怎么办?猿辅导:家长要注意这几点

Solving plane stress problem with MATLAB

xshell中怎么切换到root用户
随机推荐
Sentinel source code analysis Part 6 - sentinel adapter module Chapter 4 zuul2 gateway
How to seamlessly transition from traditional microservice framework to service grid ASM
[concurrent programming] if you use channel to solve concurrency problems?
If the amount exceeds 6 digits after the decimal point, only 6 digits will be reserved, and if it is less than 6 digits, it will remain the same - Basic accumulation
Quality management of functional modules of MES management system
存储引擎分析
Online sql to CSV tool
Seata 與三大平臺攜手編程之夏,百萬獎金等你來拿
xshell中怎么切换到root用户
田口实验法
[recommended] how to quickly locate a bug during testing
如何查看一个文件夹下所有文件的大小?
VIM editor common instructions
ResizeKit2.NET大小和分辨率独立
在线SQL转CSV工具
利用tsne将不同句子关于相似度可视化出来
浅析现代Web端im即时通讯开发技术
RubyMine开发工具,重构和意图操作
Cloud, IPv6 and all-optical network
Three text to speech artifacts, each of which is very practical