//Two-level pointer memory model ③#define_crt_secure_no_warnings#include<stdio.h>#include<stdlib.h>#include<string.h>//Detailed memory model//One-dimensional array type is typedef int MYARR[5]; Myarr A; (where Myarr is a one-dimensional array type)//Myarr *p;p is a pointer to a one-dimensional array//The type of pointer that is a one-dimensional array is a typedef int (*PARRTYPE) [5]; Parrtype p; (where parrtype is an array pointer type) p points to an array//p=&a;//typedef int (*PARRTYPE) [5]; Parrtype p; can be directly defined as int (*p) [5]; P is an array pointer, pointing to a typedef int MYARR[5]; an array of types//the step size of P is sizeof (int) *5=40 bytes//iterating through an arrayintPrintfarr (Char(*pin) [ -],intnum) { intErro_msg =0; if(pin==NULL) {erro_msg=1; printf ("pin==null Erro msg:%d\n", erro_msg); returnerro_msg; } inti =0; //Print Array//Note the step size of the pin is sizeof (char) *20 The pin+1 span is 20 bytes for(i =0; i < num; i++) {printf ("%s\n", * (pin+i)); } returnerro_msg;}voidMain () {Chartarr[3][ -] = {"AAA","BBB","CCC"}; //Tarr is essentially a pointer to a one-dimensional array whose type is typedef char (*PARRTYPE) [20]; The step size is sizeof (char) *20//variables of typedef char (*PARRTYPE) [20] type can be defined directly as char (*P) [+]Printfarr (Tarr,3); System ("Pause");}
C language Level Two pointer memory model ③