I need to use the execusion parameters argc and argv and print n time the message. This n number must be higher than 1. So the outup should looke like:
$ ./hello1 3
$ hello1 1!
$ hello1 2!
$ hello1 3!
I understand how argc and argv works, more or less, but i don't have any idea of how I can solve this. Any of you know any page where I can find any explanation? My code is and I am aware it is not correct:
#include <stdio.h>
int main(int argc, char*argv[])
{
if (argc>0)
for (int i=1; i<=argc; i++){
printf("Hello1 %d!", i);
}
else if (argc==0){
printf("not correct");
}
else{
printf("number must be greater thant 0");
}
return 0;
}