C语言链表梳理-1

#include  

struct Person {
	char *Name;
	int Age;
	int Sex;
	struct Person *Couple;
};

struct Person P1;
struct Person P2;

int main(void)
{
	printf("Hello World!\r\n");
	
	P1.Name 	= "P1";
	P1.Age  	= 30;
	P1.Sex  	= 1;
	P1.Couple 	= &P2;

	P2.Name 	= "P2";
	P2.Age  	= 30;
	P2.Sex  	= 0;
	P2.Couple 	= &P1;
	
	printf("P1's couple name is %s\r\n", P1.Couple->Name);
	printf("P1's couple age  is %d\r\n", P1.Couple->Age);
	printf("P1's couple sex  is %d\r\n", P1.Couple->Sex);
	
	return 0;
}

C语言链表梳理-1_第1张图片

你可能感兴趣的:(C,c语言,链表,开发语言)