Im trying to get a programme im writing to compare what a user inputs to a word stored in a pointer. The code is below
int c_s(char*, char*);
int main()
{
printf("Hate crime reporting system\n\n\n");
printf("If the crime you are reporting is an emergency,\nplease call 999, do
not proceed any further with this form\n\n\n\nPlease press enter to confirm
you have read the above and continue\n");
char enter = 0;
while (enter != '\r' && enter != '\n') { enter = getchar(); }
int a;
long long int g;
char *b, *e;
char *c = "witness";
char *d = "yes";
*c = (long long int) &g;
printf("Are you a victim or witness of the crime?\nPlease answer
victim/witness\n");}
scanf("%s", b);
int r = strcmp (b, c);
if(r == 0){
printf("Do you know who the witness is? Please answer yes/no\n");}
scanf("%s", d);
int f = strcmp(e, d);
if (d = "no") goto NEXT;
if(e == 0){
printf("Please enter their details including phone number and
address");}
NEXT:
When a user answers "witness" to the question "are you a victim or witness", i want the code to continue and ask the next question, and then the same again if they answer "yes or "no" to the question "do you know who the witness is?". When i run this code i get an overflow error. Im new to coding so if anyone could provide sample code on how to make this work i would greatly appreciate it. Im not sure whether im using the pointer wrong or whether i should be using an array?
Can someone also please explain how i would make this an if statement, meaning if the user types in "victim" as the answer to the above question, the programme continues to "NEXT:"
b. You cannot put data into that pointer until there is memory for it.*c = (long long int) &g;- yikes