My code is repeatedly giving me the error message segmentation fault even though I have no idea what it means. I am trying to create a Caesar cipher but my code keeps giving me error messages. I have no idea what the problem is and any help will be appreciated.
#include <stdio.h>
#include<cs50.h>
#include<string.h>
#include<ctype.h>
void encrypt(int k,string text);
int main(int argc,string arcv[])
{
if(argc != 2)
{
printf ("Please return a vaild command line argument");
return 1;
}
else
{
printf("Enter your text here:");
string s = GetString();
int x;
x = (int) (arcv[1] - '0');
encrypt(x,s);
}
}
void encrypt(int k,string text)
{
if(k > 26)
{
k = k % 26;
}
for(int i = 0;i < strlen(text); i++)
{
if(isalpha(text))
{
printf("%c",text[i] + k);
}
else
{
printf("%c",text[i]);
}
}
}