Help with string compare - exam project

I am making a program for an exam project, but i simply cant compare two strings.
What i need to compare are two names(both are names that i type into the serial) . I’ve made sure that the names are identical.
The way i am trying to make it work is with this code:

for(int i = 0; i < 5; i++){
    if(fornavn_soeg_str == person[i].fornavn_str || fornavn_soeg_str == person[i].efternavn_str){
      Write something");
    }
    if(fornavn_soeg_str == person[i].fornavn_str && efternavn_soeg_str == person[i].efternavn_str){
      Serial.print("Write something");
    }
  }

Ive also tried the .equal function, but i cannot compile my program then.

Ive tried to make an != statement instead, and then i will get an result, so the arduino are executing the code.

Im pretty new to arduino and coding in general, so please tell me if there is something i need to explain more. The same if my english is bad.

What ive done to make sure that the strings are the same, is this:

 Serial.println((int)fornavn_soeg_str[3]);
 Serial.println((int)efternavn_soeg_str[3]);



  Serial.println("fornavn: ");
  for(int i = 0; i <20; i++){
    Serial.print(fornavn_soeg_str[i]);
  }

  Serial.println("efternavn: ");
  for(int i = 0; i <20; i++){
    Serial.print(efternavn_soeg_str[i]);
  }


//navn debug

  Serial.println("navn debug");
   Serial.println((int)person[0].fornavn_str[3]);
   Serial.println((int)person[0].efternavn_str[3]);



  Serial.println("fornavn: ");
  for(int i = 0; i <20; i++){
    Serial.print(person[0].fornavn_str[i]);
  }

  Serial.println("efternavn: ");
  for(int i = 0; i <20; i++){
    Serial.print(person[0].efternavn_str[i]);
  }

And this is what i get from serial (the name that i type in is “mat bru”):

0
0
fornavn: 
mat efternavn:
bru navn debug
0
0
fornavn:
mat efternavn:
bru

strcmp is really good for comparing strings.

I like your use of code tags (that's really, really good), but I hate your use of snippets.

Does the strings need to be pointers when using the strcmp? All of the examples ive found are using pointers, and i cant get my code to work, so i might believe that i why.

Does the strings need to be pointers when using the strcmp?

Yes, but that's rarely, if ever, a problem.

I am making a program for an exam project, but i simply cant compare two strings. What i need to compare are two names(both are names that i type into the serial) . I've made sure that the names are identical.

Simple character string comparison to operate the arduino LED.

// zoomkat 8-6-10 serial I/O string test
// type a string in serial monitor. then send or enter
// for IDE 0019 and later

int ledPin = 13;
String readString;

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT); 
  Serial.println("serial on/off test 0021"); // so I can keep track
}

void loop() {

  while (Serial.available()) {
    delay(3);  
    char c = Serial.read();
    readString += c; 
  }

  if (readString.length() >0) {
    Serial.println(readString);

    if (readString == "on")     
    {
      digitalWrite(ledPin, HIGH);
      Serial.println("LED ON");
    }
    if (readString == "off")
    {
      digitalWrite(ledPin, LOW);
      Serial.println("LED OFF");
    }
    readString="";
  } 
}

This is how strcmp using char array.

/**This function calculates the dictionary value of the string and compares it to another string.
it returns a number bigger than 0 if the first string is bigger than the second
it returns a number smaller than 0 if the second string is bigger than the first
input: string1, string2
output: value- can be 1, 0 or -1 according to the case*/
int strcmp(unsigned char string1[], unsigned char string2[])
{
    int i=0;
    int value=2;    //this initialization value could be any number but the numbers that can be      returned by the function
    int strlen = sizeof(string1);
    while(value==2)
    {
        if (string1[i]>string2[i])
        {
            value=1;
        }
        else if (string1[i]<string2[i])
        {
            value=-1;
        }
        else
        {
            i++;
            if(i > strlen)
             value=0;
        }
    }
    return(value);
}

zoomkat: Simple character string comparison to operate the arduino LED.

You misspelled "String".

AWOL: You misspelled "String".

No miss spelling, the reference is to the string of characters being compared, not the method of storage or method of comparison. I'm just having some holiday fun..., you can spit the hook out now. 8)