Я пытаюсь сохранить некоторые данные в вызове массива Holder
, и проблема в том, что когда я показываю этот массив ничего не хранится я в нем, и я не знаю, что не так, хотя логика кажется мне правильной. Данные поступают от вызова массива отправителя
Я использую двухмерный массив, чтобы хранить их до 5 на MAX.
for (int t = 0; t < strlen(sender) && stop == false; t++){ // stop is the bool that created to break the loop
if (sender[t] != ';'){ // all the data being store in the holder will be separated by ';'
holder[d][t] = sender[t];
}
if (sender[t] == ';') // if the sender at position of 't' number meet ';' then plus one to start store the next data
d++;
if (holder[d][t] == '\0'){ // if it meet the '\0' then exit from the for loop
holder[d][t] = '\0'; // If `;` found, null terminate the copied destination.
stop = true;
}
}
Это массив отправителя «Привет; Как; Есть; До свидания»
Результат:
Ваш держатель -----> '
Фактический держатель --->' Привет '