char initial_req_item[MAX_ANSWER_COUNT][10] = {" ", "свиня", "меч"};
int initial_req_val[MAX_ANSWER_COUNT] = {0, 1, 1};
int is_initial_req[MAX_ANSWER_COUNT] = {0, 1, 1};
char initial_opt[MAX_ANSWER_COUNT][100] = {"Искам броня", "Убих оная свиня дето ми заръча", "Дай да говоря с кагана"};
TreeNode* my_root = init_node("Съмнителен индивид- Добре дошъл в нашия град. Добре дошъл в България. С какво мога да ти помогна?", initial_opt, 0, is_initial_req, initial_req_item, initial_req_val);
I get the error when passing the initial_req_item parameter, but I can't find a way to deal with it since the function expects multidimensional array of characters and I give it a 2 multidimensional array of characters
TreeNode* init_node(char NPC[500], char PLAYER[MAX_ANSWER_COUNT][100], int cycle, int IS_REQ[MAX_ANSWER_COUNT], char REQ_ITEMS[MAX_ANSWER_COUNT][100], char REQ_VALS[MAX_ANSWER_COUNT])
It wants char REQ_ITEMS[MAX_ANSWER_COUNT][100]
(which decays to char (*)[100]
but you're passing it char initial_req_item[MAX_ANSWER_COUNT][10]
(which decays to char (*)[10]
). Only the first layer of arrays decay to pointers, so the rest of the sizes have to match still. If that's too limiting for you, consider changing to a type like char **
(i.e., an array of pointers instead of an array of arrays).