Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void swap_recs(void *record1, void *record2)
- {
- //printf("hi\n");
- //record1=malloc(sizeof(Record));
- //record2=malloc(sizeof(Record));
- Record temp;
- temp.id = * (int *)(record1+0);
- strcpy(temp.name, (char *)(record1+sizeof(int)) );
- strcpy(temp.surname, (char *)(record1+sizeof(int) + 15*sizeof(char)) );
- strcpy(temp.city, (char *)(record1+15*sizeof(char) + 20*sizeof(char)) );
- * (int *)(record1+0) = * (int *)(record2+0);
- strcpy((char *)(record1+sizeof(int)), (char *)(record2+sizeof(int)) );
- strcpy((char *)(record1+sizeof(int) + 15*sizeof(char)), (char *)(record2+sizeof(int) + 15*sizeof(char)) );
- strcpy((char *)(record1+15*sizeof(char) + 20*sizeof(char)), (char *)(record2+15*sizeof(char) + 20*sizeof(char)));
- * (int *)(record2+0) = temp.id;
- strcpy( (char *)(record2+sizeof(int)), temp.name );
- strcpy((char *)(record2+sizeof(int) + 15*sizeof(char)), temp.surname );
- strcpy((char *)(record2+15*sizeof(char) + 20*sizeof(char)), temp.city );
- //printf("sygkrina %d %s me %d %s \n", temp.id,temp.name, (char *)(record2+sizeof(int)) );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement