i followed quzah and chris, then write this program:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char *argv[])
{
int i;
int num;
printf("argc: %d\n", argc);
num=atoi(argv[1]);
printf("argv[1] is the paramenter represents the number u wanna print.\n");
printf("argv[1]=%d\n",num);
srand(time(NULL));
for (i = 0; i < num; i++) {
printf("%d ", rand() % 10);
}
return 0;
}
i used gcc to compile and exexute,and get the right result.
if any potential problems,correct me.