Sort of Structs
Function to Sort a struct-array called „adres“ after namewise, with holding additional fields together
void Sort(struct adres sort[], int nr) { int i,j; struct adres *temp; temp = (struct adres *)malloc(sizeof(struct adres *)); if(NULL == temp) { printf("Konnte keinen Speicher reservieren...\n"); return; } for(i = 0; i < nr; i++) { for(j=i+1;j<nr;j++) { if(strcmp(sort[i].nname, sort[j].nname) > 0) { /*could be a "a < i" operation for numberwise sorting of rankings or smth*/ *temp=sort[j]; sort[j]=sort[i]; sort[i]=*temp; } } } printf(".....Sortiert!!\n\n");