test[0].programme is assigned with "Hello World". Then I input "Hello World" into key.programme to compare it with test[0].programme but it just never work even it' already same. How can i solve it? TY
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct record{
char programme[BUFSIZ];
};
typedef struct record record;
int main(){
record key;
record test[1];
strcpy(test[0].programme, "Hello World\n");
printf("Input received from test[0].programme: %s\n", test[0].programme);
printf("Programme: ");
fgets(key.programme, sizeof(key.programme),stdin);
printf("\nInput received from key: %s", key.programme);
if(key.programme == test[0].programme){ //compared but wont work
printf("Working. Match found\n");
}else{
printf("Nope. Something went wrong\n");
}
}