参考:int main(int argc,char * argv[]) windows 下的使用
参考:The program can't start because libgcc_s_dw2-1.dll is missing
Notice:
- 需要关闭 cmd 然后运行 C 程序
- 打开 cmd 测试
- 提示错误的话,就增加路径到环境变量
测试代码: test3.c
#include <stdio.h> int main(int argc,char * argv[]) { int i; printf("The number of variables are %d. ",argc); for (i=0;i<argc;i++) { printf("%02d %s ",i, argv[i]); } }
编译后会生成文件 test3.exe ,然后执行下面操作,效果如下所示:
C:Usersz5194293OneDrive - UNSW 1-UNSW 3-CoursesCOMP9024CodeBlocks>test3 alex bn lee The number of variables are 4. 00 test3 01 alex 02 bn 03 lee