I have used the function atoi to convert character strings to int and it\'s working fine but when I gave
atoi
int
num = atoi (argv[1]) ; /
Use strtoul instead of atoi. The latter results in undefined behavior if the value overflows int, which is what happens in your case.
strtoul