Friday, 20 April 2007

C with input argue

main(int argc,char *argv[])
{
char b[10];int c,d;

strcpy(b,argv[1]);/*get the first parameter*/

c=atoi(b);/*convert string to numbers*/
d=c+1;

printf("argv[1] is %s\n\n",b);
printf("convert argv[1] is %d\n",c);
printf("d=c+1 is %d\n",d);
}

No comments:

My photo
London, United Kingdom
twitter.com/zhengxin

Facebook & Twitter