当前位置:网站首页>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
边栏推荐
- Tetris game based on STM32F103
- 如何拒绝期末复习无用功?猿辅导:找准适合自己的复习方法很重要
- UDP servers and clients in go
- [recommendation system] concise principle and code implementation of user based collaborative filtering
- Sklearn notes: make_ Blobs generate clustering data
- Some thoughts on small program subcontracting and verification of uiniapp subcontracting optimization logic
- Sentinel source code analysis Chapter 9 - core process - lookprocesschain finding resource processing chain
- Storage engine analysis
- Sentinel source code analysis Part 8 - core process - sphu Entry current limiting execution
- Twitter launches the test of anti abuse tool "safe mode" and adds enabling prompt
猜你喜欢

Kubernetes 核心对象概览详解

The first unlucky person watching eth 2.0

Machinery -- nx2007 (UG) finite element analysis tutorial 1 -- simple object

数据中台咋就从“小甜甜”变成了“牛夫人”?

Preliminary understanding of NVIDIA Jetson nano

在线SQL转CSV工具

Solving plane stress problem with MATLAB

2022 6 月25 日交易总结

postman 之接口关联

How to seamlessly transition from traditional microservice framework to service grid ASM
随机推荐
Precautions for postoperative fundus hemorrhage / / must see every day
Seata and the three platforms are working together in the summer of programming. Millions of bonuses are waiting for you
[mrctf2020]ezpop-1 | PHP serialization
[spark] basic Scala operations (continuous update)
Text classification using huggingface
Online text digit recognition list summation tool
数字垃圾是什么?跟随世界第一位AI艺术家,探索元碳艺术
Good test / development programmers vs. average programmers
C language final without failing (Part 1)
Transaction summary on June 25, 2022
The unity editor randomly generates objects. After changing the scene, the problem of object loss is solved
Unity编辑器随机生成物体,更换场景之后物体丢失问题解决
MES管理系统功能模块之质量管理
Wechat applet - requestsubscribemessage:fail can only be invoked by user tap gesture
[Thesis Writing] English thesis writing guide
How to refuse the useless final review? Ape tutoring: it is important to find a suitable review method
[535. encryption and decryption of tinyurl]
I, 33 years old, ByteDance test development, unveiled the real income of Beijing "test post"
VIM editor common instructions
利用tsne将不同句子关于相似度可视化出来