-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdimension_array_pointer.c
56 lines (52 loc) · 1.48 KB
/
dimension_array_pointer.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* =====================================================================================
*
* Filename: dimension_array_pointer.c
*
* Description: This is the Chapter 04 learning code
* This file shows how the difference between two dimension
* pointers and array
*
* Version: 1.0
* Created: 2016年05月26日 17时44分53秒
* Revision: none
* Compiler: gcc
*
* Author: Y.Tian
*
* =====================================================================================
*/
#include <stdlib.h>
#include <stdio.h>
int main ( int argc, const char *argv[] )
{
printf("================ Two Dimension Pointer and Pointer's Array================\n");
/*Pointer's Array*/
char *titlesPointerArray[]={
"A Tale of Two Cities",
"Wuthering Heights",
"Don Quixote",
"Odyssey",
"Moby-Dick",
"Hamlet",
"Gulliver's Travels"
};
/*2D Pointer*/
char **dimensionPointer;
dimensionPointer = titlesPointerArray;
printf("%s and %c\n", titlesPointerArray[0], **dimensionPointer);
printf("================ Two Dimension Array and Array's Pointer================\n");
/*2D Array*/
char titlesDimensionArray[][40]={
"The Art of Computer Programming ",
"Python Programming Guide",
"Programming Pearl",
"Computer Network",
"Modern Perl"
};
/*Array's Pointer*/
char (*arrayPointer)[40];
arrayPointer = titlesDimensionArray;
printf("%s and %c\n", titlesDimensionArray[0], **arrayPointer);
return EXIT_SUCCESS;
}