if (argv[1] == NULL)
{
printf("Usage: ./caesar key\n");
return(1);
}
this is the solution before the program received the first statement validate null
Since argv[1] does not exist, argv[1] is out of bounds and causes a segmentation fault.
Use argc to check if argv[1] exists.
Hope this helps. If it does then please check the tickmark.
You must declare the return value
int main(int argc, string argv[] and put these sentences after declarated int l, i, rd = 0; char cadena[100], k, cara[2];
the program check the first emtry and validate
Start by checking the value of argc. If argc<2, then argv[1] doesn't exist.
Note that if argv[1] doesn't exist, you can't check if it contains anything, including NULL.
Any attempt to access a nonexistent argv[1] will generate a seg fault.