?
”,
7.3
…
7.3.2
*( 1 2… )
{
}
7.3
7.3.2
return
7.3.3
*
(*p)()p
7.3
7.3.3
(1)int *p()
(2) p =
(3) c = *p();
pc
7.3.4
7.3
CC
7.4.1
7.4.1.1
C
int a[10];
a&a[0]a[1]a+1&a[1]
a[3]*(a+3)*&a[3]
7.4
7.4.1.1
#include<stdio.h>
main()
{ int i,a[]={1,2,3,4,5};
for (i=0;i<5;i++)
printf("%d ",*(a+i));
}
7.4
7.4.1.2
7.4
7.4.1.3
s
7.4
7.4.1.4
7.4.2.1
7.4
7.4.2.1
7.4
3.
7.4
7.4.2.2
7.4
7.4.2.2
int a[3][2],(*ptl)[2]; (*ptl)[2] *ptl ptl [2] ptlint ptl aptl=a ptl+1
a+1,a[1]ptlaa[i][j]:
*(ptl[i]+j) *(*(ptl+i)+j) (*(ptl+i)[j] ptl[i][j]
7.4
7.4.2.3
int( int *p,int m,int n)
fun( int a[M][N]) fun(int a[][N]) fun(int (*a)[N])
7.4
7.4.3
,”
,”
7.4
,”,,
7.4
7.4
:
7.4
7.4.4.1
1
char*days[]={“Sunday”,“Monday”,“Tuesday”,
“Wednesday”,“Thursday”,“Friday”,“Saturday”};
2
1
7.4
7.4.4.1
2
charcolor1[][6]={“red”,“green”,“blue”};
char *color[]={“red”,“green”,“blue”};
7.4
7.4.4.2
char **p;
7.4
7.4.4.3
mainmain
main
main
truboC
1.
1 2,....,n
7.4
7.4.4.3
2,C
C0
3.
main( int argc,char *argv[]);
argc:
argv[],argv[0]argv[1]argv[2]...
argc,argv
7.4
7.5.1 C
<stdlib.h>
1,malloc()
void *malloc(size_tn) ;
size_t:
void *
n
7.5
7.5.1 C
(1) sizeof;
(2) malloc;
(3) ;
(4) ;
2,calloc()
void calloc(size_t n,size_t size);
size_tnsize_tsize
void *
n*size
7.5
7.5.1 C
3,free()
void free(void *p);
pp
free(q)p
4,realloc()
void *realloc(void *p,size_t n);
pnNULLpp
7.5
7.5.2 C
(1)
if ((p=(...*)malloc(...))==NULL) {
.../* */
}
(2)sizeof
(3)
(4)free
7.6 --
(1)
(2)
(3)
(4)
7.5
”,
7.3
…
7.3.2
*( 1 2… )
{
}
7.3
7.3.2
return
7.3.3
*
(*p)()p
7.3
7.3.3
(1)int *p()
(2) p =
(3) c = *p();
pc
7.3.4
7.3
CC
7.4.1
7.4.1.1
C
int a[10];
a&a[0]a[1]a+1&a[1]
a[3]*(a+3)*&a[3]
7.4
7.4.1.1
#include<stdio.h>
main()
{ int i,a[]={1,2,3,4,5};
for (i=0;i<5;i++)
printf("%d ",*(a+i));
}
7.4
7.4.1.2
7.4
7.4.1.3
s
7.4
7.4.1.4
7.4.2.1
7.4
7.4.2.1
7.4
3.
7.4
7.4.2.2
7.4
7.4.2.2
int a[3][2],(*ptl)[2]; (*ptl)[2] *ptl ptl [2] ptlint ptl aptl=a ptl+1
a+1,a[1]ptlaa[i][j]:
*(ptl[i]+j) *(*(ptl+i)+j) (*(ptl+i)[j] ptl[i][j]
7.4
7.4.2.3
int( int *p,int m,int n)
fun( int a[M][N]) fun(int a[][N]) fun(int (*a)[N])
7.4
7.4.3
,”
,”
7.4
,”,,
7.4
7.4
:
7.4
7.4.4.1
1
char*days[]={“Sunday”,“Monday”,“Tuesday”,
“Wednesday”,“Thursday”,“Friday”,“Saturday”};
2
1
7.4
7.4.4.1
2
charcolor1[][6]={“red”,“green”,“blue”};
char *color[]={“red”,“green”,“blue”};
7.4
7.4.4.2
char **p;
7.4
7.4.4.3
mainmain
main
main
truboC
1.
1 2,....,n
7.4
7.4.4.3
2,C
C0
3.
main( int argc,char *argv[]);
argc:
argv[],argv[0]argv[1]argv[2]...
argc,argv
7.4
7.5.1 C
<stdlib.h>
1,malloc()
void *malloc(size_tn) ;
size_t:
void *
n
7.5
7.5.1 C
(1) sizeof;
(2) malloc;
(3) ;
(4) ;
2,calloc()
void calloc(size_t n,size_t size);
size_tnsize_tsize
void *
n*size
7.5
7.5.1 C
3,free()
void free(void *p);
pp
free(q)p
4,realloc()
void *realloc(void *p,size_t n);
pnNULLpp
7.5
7.5.2 C
(1)
if ((p=(...*)malloc(...))==NULL) {
.../* */
}
(2)sizeof
(3)
(4)free
7.6 --
(1)
(2)
(3)
(4)
7.5