#include <iostream>
#include <Windows.h>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
double num = 1024.5;
double* ptr_num = #
void* ptr_num1 = #
double* n_p = nullptr;
cout << "num的值:" << num<<endl;
cout << "num的地址:" << &num<<endl;
cout << "ptr_num的值:" << ptr_num << endl;
cout << "ptr_num的地址值:" << *ptr_num << endl;
cout << "void型指针ptr_num1是否等于double型指针ptr_num:" << (ptr_num1 == ptr_num) << endl;
cout << "n_p空指针的值:" << n_p << endl;
double&ref_num = num;
cout << "ref_num引用num的值,是num的别名。:" << ref_num <<'\t'<<&ref_num<< endl;
double score[] = { 11,22,33,44,55 };
double *ptr_score = score;
cout << "指向数组的指针:" << ptr_score[2] << '\t' << *score << '\t' << *(score+1) << endl;
cout <<"当指针碰见sizeof时会被打回原形,地址只占四了字节:"<< sizeof(score) << '\t' << sizeof(ptr_score) << endl;
vector<int>vect_num = { 10,20,80,5,66,30 };
vect_num.push_back(100);
for (int i = 0; i < vect_num.size(); i++)
{
cout << vect_num[i] << '\t';
}
cout << endl;
vector<int>::iterator it;
for (it = vect_num.begin(); it != vect_num.end(); ++it)
{
cout << *it << '\t';
}
cout << endl;
sort(vect_num.begin(), vect_num.end());
for (it = vect_num.begin(); it != vect_num.end(); ++it)
{
cout << *it << '\t';
}
cout << endl;
reverse(vect_num.begin(), vect_num.end());
for (it = vect_num.begin(); it != vect_num.end(); ++it)
{
cout << *it << '\t';
}
cout << endl;
int *ptr_int = new int;
delete ptr_int;
int*intArray = new int[10];
delete[]intArray;
int(*ptr)[3] = new int[5][3];
delete[]ptr;
system("pause");
return 0;
}