《深入理解C指针》第一章 认识指针

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

#include <bits/stdc++.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
#define maxn 10005
#define M 105

int main(){
    int num;
    int *pi = &num;
    printf("Value of pi:%p\n",pi);
    void *pv = pi;
    pi = (int*)pv;
    printf("Value of pi:%p\n",pi);
    system("pause");
    return 0;
     
} 

 

 

 

 

 

 

 

 

 

#include <bits/stdc++.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
#define maxn 10005
#define M 105

int main(){
    char *titles[] = {"A Tale of Two Cities",
    "Wuthering Heights","Don Qqixote",
    "Odyssey","Moby-Dick","Hamlet","Gulliver's Travels"};
    char **bestBooks[3];
    char **englishBooks[4];
    bestBooks[0] = &titles[0];
    bestBooks[1] = &titles[3];
    bestBooks[2] = &titles[5];
    englishBooks[0] = &titles[0];
    englishBooks[1] = &titles[3];
    englishBooks[2] = &titles[5];
    englishBooks[3] = &titles[6];
    printf("%s\n",*englishBooks[1]);
    system("pause");
    return 0;
     
} 

 

 

 

猜你喜欢

转载自www.cnblogs.com/JasonPeng1/p/11966172.html