I have an index array. Is it necessary for him to create a structure? Both the structure and the function of creating an indexed array are located outside (not in) the function main. How to display the contents of an index array in the main function? The index array still needs to be tied to a dynamic db array. The type of the elements of the name field is char.

Sorting complex structures by the bubble method

Code:

void CreateIndArr(struct dataBase *stroka, struct IndArr *indarr) //ВРОДЕ ТЕ ПАРАМЕТРЫ? { // i - кол-во записей в структуре (индекс итерации); j - кол-во символов в ячейке int t; // номер индекса в массиве for (int i=0; i<N; i++) { t=0; for (int j=0; j<32; j++) { if (stroka[i].name[j]==' ') {t++;} if (t==2) { indarr[i].dat = &stroka[i]; indarr[i].fam[0]=stroka[i].name[j+1]; indarr[i].fam[1]=stroka[i].name[j+2]; indarr[i].fam[2]=stroka[i].name[j+3]; t++; } } } } 
  • Please make the code as a code, not a screen shot. - αλεχολυτ
  • one
    By editing the body of the question, not a comment :) - αλεχολυτ
  • What is the variable N ? - Jagailo
  • This is the constant #define N 4. It means that the number of entries in the dataBase structure is 4. - Muriam

0