I am getting error messages compiling this code though it seems right. What did I do wrong since i'm just following examples. I am following the examples of using the atoi function but am still getting messages:
error: declaration shadows a local variable [-Werror,-Wshadow] int k = atoi(argv[1]); ^
caesar.c:12:16: note: previous declaration is here string k = argv[1]; ^
caesar.c:13:13: error: redefinition of 'k' with a different type: 'int' vs 'string' (aka 'char *') int k = atoi(argv[1]); ^
caesar.c:12:16: note: previous definition is here string k = argv[1]; ^
#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
int main(int argc, string argv[])
{
if (argc != 2)
{
printf("Error\n");
return 1;
string k = argv[1];
int k = atoi(argv[1]);
}
}