linux下GCC编译器,怎么在main后面的参数中写入数字来传入数据。 比如实现 Calc + 22 22 输出 44 。
linux下GCC编译器,怎么在main后面的参数中写入数字来传入数据。 比如实现 Calc + 22 22 输出 44 。
日期:2012-10-23 17:33:15 人气:2
[root@liuxiting .test~]# cat test.c
#include
#include
int main(int argc, char *argv[])
{
int a, b;
char c;
if ( argc < 3)
printf("wrong parameter \n");
else
{
a = atoi(argv[2]);
b = atoi(argv[3]);
c = *argv[1];
if ( c ==