Now the author seems to have become this, I am normal?
Whether it is not normal, start today's coding:
#include <stdio.h>structstudent{intID; Char*Name; intAge ;};//defines a structure that contains student ID, name, age three fields studentintMain () {structStudent mystudent = {1,"Luo Shuai", -};//instantiate a struct and assign a valueprintf"ID value of the mystudent instance variable:%d\n", mystudent.id); printf ("the name value of the mystudent instance variable:%s\n", Mystudent.name); printf ("Age value of mystudent instance variable:%d\n", mystudent.age);//output the individual field values of the instance variable mystudent return 0;//Exit Program}
Attached:
Description at the end of the article:
1. In a struct, the name field can be declared as char* name or char Name[number] (number indicates the maximum length of the name field);
2, there is about the use of pointers, the author will be a single example to fine-talk, please look forward to!
C + + Learning Journey-Combat 2-output multi-type variable data using struct struct body