I'm currently learning C programming. This is the C code to encrypt a string.
#include <stdio.h>
#include <stdlib.h>
void encrypt(char *message){ // Here message is a character pointer - array
//char c;
while(*message){
*message = *message ^31;
message++;
}
}
int main(int argc, char const *argv[])
{
char *msg = {"Hello Howdy?"};
encrypt(msg);
return 0;
}
I'm getting 'Segmentation fault(core dumped)' as the output. It compiles though.