初学者:请教结构体数组排序!
我在做结构体数组排序,可是结构体数组,不能像变量那样直接的交换值,我要怎么做?
请大家指教!
结构如下:
#define N 3
struct student
{
int num[4];/* 学号 - num[13](字符串) */
char name[8];/* 姓名(字母)- name[25](字符串) */
char sex[1];/* 性别 - sex(字符,M或F) */
int brith[4];/* 出生年份 - birth(整型) */
char phone[10];/* 电话 - phone[12](字符串) */
char address[40];/* 籍贯 - address[50](字符串) */
}stu[N];
要根据学号排序