Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <stdio.h>
- #include <string.h>
- #include <conio.h>
- #include <stdlib.h>
- #define NO_OF_STUDENTS 20
- struct data
- {
- char name[20];
- int age;
- int weight;
- };
- int main ()
- {
- int n;
- struct data Students[NO_OF_STUDENTS]; // 20 students.
- int Counter = 0;
- for(; Counter < NO_OF_STUDENTS; ++Counter)
- {
- Students[Counter].name[NO_OF_STUDENTS] = '\0'
- scanf("%s", Students[Counter].name[Counter]);
- scanf("%d", Students[Counter].age);
- scanf("%d", Students[Counter].weight);
- }
- qsort (Students[20].age,20, sizeof(int), compare); // i dont know what do with this
- for (n=0; n<NO_OF_STUDENTS; n++)
- printf ("%d ",values[NO_OF_STUDENTS]);
- return 0;
- }
- int compare (const void * a, const void * b)
- {
- return ( *(int*)a - *(int*)b );
- }
Advertisement
Add Comment
Please, Sign In to add comment