Разделение строки

Простые типы / Строки

//strtok cuts the string in place, so it must be an array, not a literal
char strData[] = "1981|Kim Victoria|engineer";
char *arrData[3];
int count = 0;
for (char *item = strtok(strData, "|"); item != nullptr && count < 3;
        item = strtok(nullptr, "|")) {
    arrData[count++] = item;
}

int year = atoi(arrData[0]);
//year is 1981
char *name = arrData[1];
//name is "Kim Victoria"
char *position = arrData[2];
//position is "engineer"

printf("year is %d\n", year);
printf("name is %s\n", name);
printf("position is %s\n", position);