If this is for example for Caesar cipher and you're running ./caesar 2
then key should indeed be set to an integer of 2
as argv[0]
is the program name and argv[2]argv[1]
is the string 2
.
But int atoi(message);
first doesn't set the return value of atoi to anything, no variable, and also if message is a string of chars, which from it's name it seems to be, then calling atoi on it will indeed return 0. Although you're not saving that anywhere yet.
Hope that helps Sean