The content of my reduced CSV test file is the following.
arr = ["company,location,region,service,price,duration,disabled\n",
"Google,Berlin,EU,Design with HTML/CSS,120,30,FALSE\n",
"Google,San Francisco,US,Design with HTML/CSS,120,30,FALSE\n",
"Google,San Francisco,US,Restful API design,1500,120,FALSE\n",
"Apple,London,EU,Design with HTML/CSS,120,30,FALSE\n",
"Google,Berlin,EU,Design with HTML/CSS,120,30,FALSE\n",
"Apple,Berlin,EU,Restful API design,1500,120,FALSE\n",
"IBM,San Francisco,US,Design with HTML/CSS,120,30,TRUE\n",
"Google,San Francisco,US,Design with HTML/CSS,120,30,FALSE\n",
"IBM,Berlin,EU,Restful API design,1500,120,TRUE\n",
"IBM,London,EU,Restful API design,1500,120,TRUE\n",
"IBM,Berlin,EU,Restful API design,1500,120,TRUE\n",
"IBM,London,EU,Restful API design,1500,120,TRUE\n",
"IBM,San Francisco,US,Design with HTML/CSS,120,30,TRUE\n",
"Google,Berlin,EU,Advanced AngularJS,1200,180,FALSE\n",
"Google,Berlin,EU,Restful API design,1500,120,FALSE\n",
"Google,London,EU,Restful API design,1500,120,FALSE\n",
"Apple,San Francisco,US,Design with HTML/CSS,120,30,FALSE\n",
"Google,San Francisco,US,Restful API design,1500,120,FALSE\n",
"IBM,Berlin,EU,Restful API design,1500,120,TRUE\n"]
这里argc是一个整数变量,表示传递的参数数量。 argv是一个指向字符的指针数组 我怀疑是否看到了使用
的程序main(int argc,char *argv[])
{
......;
......;
}
它是否有效我们可以使用argv作为指向整数的指针数组吗?
答案 0 :(得分:-3)
#include <stdio.h>
int main(int argc, int*argv[])
{
int a=3;
int b=4;
printf("\n%s", (char*)argv[1]);
return 0;
}
命令行参数:abcd
输出:abcd
我已经编译了上面的代码并且在我尝试的编译器中完美地工作了。 似乎某些编译器允许使用int* argv[]
。我认为这是编译器特定的一些将允许它而其他不会。你必须为传递的参数提供适当的转换。
注意:我并不是说它适用于每个编译器和每个环境。 :)强>