Incompatible types when assigning a string to the char array

advertisements

This question already has an answer here:

  • problems with char array = char array 2 answers

so this is basically what i have atm. (This is for C)

char score[50];

if (num == 0){
    score = "draw";
    }
else if (num == 1){
    score = "100";
    }
else if (num == 2){
    score = "200";
    }

But i keep getting the error, incompatible types when assigning to type char [50] from type int. How do i fix this error?


Use strcpy: char *strcpy(char *dest, const char *src)

#include <string.h>    //include the library containing the function strcpy

if (num == 0){
    strcpy(score, "draw");
}
else if (num == 1){
   strcpy(score, "100");
}
else if (num == 2){
    strcpy(score, "200");
}