当前位置:网站首页>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
边栏推荐
- Stimulsoft Reports报告工具,Stimulsoft创建和构建报告
- Common settings in idea
- Tetris game based on STM32F103
- Taguchi experimental method
- Quick Pow: 如何快速求幂
- 数字垃圾是什么?跟随世界第一位AI艺术家,探索元碳艺术
- Stimulus reports reporting tool, stimulus creates and builds reports
- [recommendation system] concise principle and code implementation of user based collaborative filtering
- Wechat applet - requestsubscribemessage:fail can only be invoked by user tap gesture
- In depth analysis of a large number of clos on the server_ The root of wait
猜你喜欢

【深度学习编译】算子编译 IR 转换

在线SQL转CSV工具

Cloud, IPv6 and all-optical network

R language linear regression model fitting diagnosis outliers analysis of domestic gas consumption and calorie examples with self-test questions

Three text to speech artifacts, each of which is very practical

I learned database at station B (V): DQL exercise

【535. TinyURL 的加密与解密】

Tetris game based on STM32F103

How did the data center change from "Britney Spears" to "Mrs. bull"?

网易云音乐内测音乐社交 App“MUS”,通过音乐匹配同频朋友
随机推荐
Go 中的 UDP 服务器和客户端
Antd - tree structure: default deployment node attribute failure - Basic promotion
In 2022, the latest and most detailed idea associated database method and visual operation of database in idea (including graphic process)
I learned database at station B (V): DQL exercise
Quality management of functional modules of MES management system
【Proteus仿真】8位端口检测8独立按键
Shell spec date format
How to seamlessly transition from traditional microservice framework to service grid ASM
ResizeKit2.NET大小和分辨率独立
关于c语言main函数中int argc,char **argv的理解
What is digital garbage? Follow the world's first AI artist to explore meta carbon Art
Seata and the three platforms are working together in the summer of programming. Millions of bonuses are waiting for you
数字垃圾是什么?跟随世界第一位AI艺术家,探索元碳艺术
Is the course of digging money reliable and safe to open an account?
Mechanical --nx2007 (UG) -- gap analysis (interference inspection)
Machine learning notes: time series decomposition STL
Sentinel source code analysis Part 6 - sentinel adapter module Chapter 4 zuul2 gateway
[recommendation system] concise principle and code implementation of user based collaborative filtering
The first unlucky person watching eth 2.0
优秀的测试/开发程序员与普通的程序员对比......