The Code is as follows:
Copy codeThe Code is as follows: typedef struct st_test
{
Int id;
Char * pName;
Char class [10];
} Student;
Void fn (Student * pStud ){
PStud-> id = 10;
PStud-> pName = "Tom Simith ";
Strcpy (pStud-> class, "Class 1 ");
Printf ("sizeof (pStud) = % d/n", sizeof (pStud); // sizeof (pStud) = 4
Printf ("sizeof (pStud-> id) = % d/n", sizeof (pStud-> id); // sizeof (pStud-> id) = 4
Printf ("id: % d/n", pStud-> id); // id: 10
Printf ("sizeof (pStud-> pName) = % d/n", sizeof (pStud-> pName); // sizeof (pStud-> pName) = 4
Printf ("strlen (pStud-> pName) = % d/n", strlen (pStud-> pName); // strlen (pStud-> pName) = 10
Printf ("Name: % s/n", pStud-> pName); // Name: Tom Simith
Printf ("sizeof (pStud-> class) = % d/n", sizeof (pStud-> class); // sizeof (pStud-> class) = 10
Printf ("strlen (pStud-> class) = % d/n", strlen (pStud-> class); // strlen (pStud-> class) = 7
Printf ("class: % s/n", pStud-> class); // class: Class 1
}
Void fnArray (char arr []) {
Printf ("arr: % s/n", arr); // arr: Hello
Printf ("sizeof (arr) = % d/n", sizeof (arr); // sizeof (arr) = 4 The length of pointer
Printf ("strlen (arr) = % d/n", strlen (arr); // strlen (arr) = 5 The length of array
}
Int main (int argc, char ** argv)
{
Student stud;
Fn (& stud );
FnArray ("Hello ");
Return 0;
}