I am new to programming trying to understand concepts of asking information by the console. When I execute this program I get a SEGV error, but I can't find what I am doing wrong. As far as I know, this happens when I try to modify a string literal, but there must be something else. Here is my code:
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#define BUFFSIZE 255
int main()
{
char *action;
char buffer[BUFFSIZE], *aux1, *aux2;
bool end = false;
while (!end)
{
size_t ct;
fgets(buffer, BUFFSIZE, stdin);
sscanf(buffer,"%s%s%s", action, aux1, aux2);
if (strcmp(action, "finish") == 0)
{
end = true;
}
else if (strcmp(action, "option2") == 0)
{
printf("%s", action);
}
else if (strcmp(action, "option3") == 0)
{
printf("%s", action);
}
}
}