this program keeps crashing instead of letting me input arguments, why?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, const char* argv[]) {
int shift = atoi(argv[1]);
char message[256];
strcpy(message, argv[2]);
int i;
for (i = 0; i < strlen(message); i++) {
printf("%c", message[i] + shift);
}
putchar('\n');
return 0;
}
I am using codeblocks. But I also tried to run it with Notepad++. After I compiled it and when I run it it simply crashes: Name.exe has stopped working. Shouldn't it ask me to input arguments on command line?