#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
struct Book
{
char name[20];
short price;
};
int main()
{
struct Book b1 = { "C语言指针指南", 105 };
struct Book* pb = &b1;
printf("书名:%s\n", pb->name);
printf("价格;%d元\n",(*pb).price);
b1.price = 100;
printf("价格;%d元\n", (*pb).price);
strcpy(b1.name, "C++");
printf("书名:%s\n", pb->name);
return 0;
}
原文:https://blog.51cto.com/14893161/2516628