C++ベースの構造体ポインタ

512 ワード

Structure Points:ポインタを使用してStructureのメンバーにアクセスします.
具体的な実装:
#include 
using namespace std;
#include

/*
	       
*/
struct Student
{
	string name;
	int age;
	int score;
};

int main() 
{
	/*
		       
	*/
	struct Student s1 = {"  ",12,68};

	/*
		         
	*/
	struct Student *p = &s1;

	/*
		             
	*/
	cout << p->age << p->name << p->score << endl;

	system("pause");
	return 0;
}