关于C++指针求解释下列问题

求解释下列问题?
1-函数必须要返回值?
2-p->num;这是什么意思?给指针指向的位置赋值?
3-cout << p->chemistry 这又是什么意思?输出p指针指向的地址所对应的值?
4-for (p1 = a; p1 < a + 2; p1++)这后面括号里的是什么?


// 69.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
using namespace std;    //定义公共结构类型
    struct student
    {
        int num;
        char name[10];
        float maths;
        float physics;
        float chemistry;
        double total;
    };
    //定义结构输入函数
    int input_Rec(struct student* p)//参数为student类型的结构指针变量
    {
        cin >> p->num;
        cin >> p->name;
        cin >> p->maths;
        cin >> p->physics;
        cin >> p->chemistry;
        return 0;
    }
    //定义结构数据交换函数
    int swap_Rec(struct student* p, struct student* p2)
    {
        struct student x;
        //交换两个记录的数据
        x = *p;
        *p = *p2;
        *p2 = x;
        return 0;
    }
    int put_Rec(struct student* p)
    {
        cout << p->num << '\t';
        cout << p->name << '\t';
        cout << p->maths << '\t';
        cout << p->physics << '\t';
        cout << p->chemistry << '\t';
        cout << p->total << endl;
        return 0;
    }
    int main()
    {
        int i, j;
        //声明结构指针变量和结构数组
        struct student* p1, a[3];
        //输入3个学生的数据并计算总成绩
        cout << "num\tname\tmaths\tphysics\tchemistry" << endl;
        for (p1 = a; p1 < a + 2; p1++)
        {
            input_Rec(p1);
            p1->total = p1->maths + p1->physics + p1->chemistry;
        }
        //对三个学生的数据排序
        for (int i = 0; i <= 2; i++)
            for (j = i + 1; j <= 2; j++)
                if (a[i].total < a[j].total)
                    swap_Rec(&a[i], &a[j]);
        cout << "__________________________________" << endl;
        //输出排序后的结构数组
        cout << "num\tname\tmaths\tphysics\tchemistry\ttotal" << endl;
        for (p1 = a; p1 <= a + 2; p1++)
            put_Rec(p1);








    }



img

1.p->结构体成员 是通过指针p访问p指向的结构体的成员变量
2.函数可以没有返回值,函数类型为void,即void 函数名