埃里克里斯钦.
9
如何创建包含字符指针的数组大小5:
char *array_of_pointers[ 5 ]; //array size5containingpointerstochar
char m='m '; //charactervalueholdingthevalue ' m '
array_of_pointers[0]=m; //assignmptrintothearrayposition 0。
printf('%c”,*array_of_pointers[0]; //get the value of the pointer to m
如何创建指向字符数组的指针:
char(*pointer_to_array ) [ 5 ]; //apointertoanarraycontaining5chars
char m='m '; //charactervalueholdingthevalue ' m '
printf(%c ),) * pointer _ to _ array [0]; //dereferencearrayandgetposition 0
如何创建包含字符指针的二维阵列:
char *array_of_pointers[5][2];
//an array size5containingarrayssize2containingpointerstochar
char m='m ';
//charactervalueholdingthevalue ' m '
array_of_pointers[4][1]=m;
//Get position 4 of array,then get position 1,then put m ptr in there。
printf('%c ',*array_of_pointers[4][1] );
//Get position 4 of array,thengetposition1anddereferenceit。
如何创建指向二维数组字符的指针:
char(*pointer_to_array ) [5][2];
//apointertoanarraysize5eachcontainingarrayssize2whichholdchars
char m='m ';
//charactervalueholdingthevalue ' m '
(*pointer_to_array ) [4][1]=m;
//dereference array,Get position 4,get position 1,put m there。
printf(%c ),) *pointer_to_array ) [4][1];
//dereference array,Get position 4,get position 1