struct User { char name[40]; //can't do dynamic memory allocation in definition int age; //int age =18; //can't initialize member in definition int tel; }; User userObject; strcpys(userObject.name, "Micheal"); userObject.age = 20; userObject.tel = 1234567; User* userPtr = &userObject; strcpy_s(userPtr->name, "Micheal"); userPtr->age = 20; userPtr->tel = 1234567;
沒有留言:
張貼留言