C 指针数组 结构体 (取结构体变量的两种方式)

#include "stdarg.h" 
#include "stdafx.h"
#include <stdio.h>
struct Student
{
	int age;
	float score;
	char sex;
};
int main(void)
{
	struct Student st = { 80, 66.6F, 'F' };
	struct Student * pst = &st;
	pst->age = 88;
	st.score = 66.7f;
	printf("%d %f\n", st.age, pst->score);//取结构体变量的两种方式
	
	int a = 12;
	//int *p = &a; 只有声明和初始化在一起的时候才能这样写 相当于下面的2行
	int *p;
	p = &a;
	printf("%d %d\n", p, *p);
	*p = a;
	printf("%d %d\n", p, *p);

	int arrray[10] = { 0,1,2,3,4,5,6,7,8,9 };
	int  b=0;
	int  c = *arrray;
	int *value = arrray;
	for (size_t i = 0; i < 5; i++)

	{
		*value = i;
		printf("%d %d %d\n", b, *value, c);

	}
	


	return 0;
}


猜你喜欢

转载自blog.csdn.net/u012611644/article/details/80818789