hi
my nephew encouraged me to take some c lessons and here I am with my questions his way and also with my first steps in learning the c, I have now this program which prints a name several times on screen. I use return 0 and 1. I'd like to hear some suggestions how to make better code, or increase the strength of my tiny software.
Code:
#include <stdio.h>
int main (int argc, char *argv[]) {
if (argc == 3) {
int count;
if (sscanf (argv[1], "%i", &count) != 1) {
printf ("Error: not an integer!\n");
return 1;
} else {
while (count > 0) {
printf("Hello %s!\n", argv[2]);
count--;
}
}
} else {
printf("\t%s [number] [name]\n", argv[0]);
}
return 0;
}