I would like help with my compare function under the removeNameCard function. Even though the print shows the same name, comparing them in an if statement is skipped.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 5
typedef struct
{
int nameCardID;
char personName[20];
char companyName[20];
}NameCard;
NameCard inputRecord[MAX];
int I;
char* p;
void removeNameCard()
{
char* a;
char* b;
char value[20];
NameCard temp[MAX];
printf("Enter personName:\n");
while ((getchar()) != '\n');
fgets(value, 20, stdin);
if (inputRecord[0].nameCardID != 0) {
for (int x = 0; x < MAX; x++) {
a = value;
b = inputRecord[x].personName;
printf(a);
printf(b);
if (value == inputRecord[x].personName) {
for (int j = x; j < MAX; j++) {
inputRecord[j] = inputRecord[j + 1];
}
inputRecord[MAX - 1].nameCardID = 0;
i -= 1;
printf("The name card is removed\n");
return;
}
else {
printf("The target person name is not in the name card holder\n");
}
}
}
else {
printf("The name card holder is empty\n");
}
}
My problem is that the value of a and b is not the same therefore when I compare it on the if statement it always skips. Is there a way to retrieve just the char value of a and b without the address?