1. typedef int* pint_t;//定义整形指针
2. //定义结构体,定义结构体指针
typedef struct {
double data;
}data_t, * pdata_t;
3. //定义函数指针,函数指针数组其实和函数指针差不多,看下面的例子
typedef void (*pfunction_t)();
#include<iostream>
#include<algorithm>
#include<string.h>
#include<string>
#include<numeric>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<vector>
#include<stack>
#include<map>
#include<stdio.h>
#include<set>
using namespace std;
double company_perfomance;
double final_performance_1;
double final_performance_2;
double final_performance_3;
double yearlyprofit[] = { 1.00,2.00,3.00,4.00,5.00,6.00 };
const char* friends[] = { "Amy", "Susan", "Alan" };
const char* food[] = { "Sushi Train", "Domino's Pizza", "soul express" };
const char* weekday[] = { "Monday", "Tuesday", "Wednesday"};
//定义普通函数指针调用
typedef void(*method_transport_t)(const char*); //定义了一个新的数据类型,名字是method_transport_t 函数指针类型
typedef double(*money_management_t)(double, double);//定义了一个新的数据类型,名字是money_management_t 函数指针类型 ---上面的方法练习
//把一个指针函数当作另外一个函数的参数
void byTrain(const char* name)
{
printf("travel with %s, go Russian by train!\n", name);
}
void byAirplane(const char* name)
{
printf("travel with %s, go Singapore by Airplane!\n", name);
}
void byShip(const char* name)
{
printf("travel with %s, go Thailand by Ship!\n", name);
}
void wayfortravelling(const char* friends[], int n, method_transport_t transportation)//调用上面的指针函数,method_transport_t是一个指针函数,被