C語言基礎 -51 構造類型_結構體的定義變量及成員引用

book@100ask:~/C_coding/CH02$ cat strct.c
#include <stdio.h>
#include <stdlib.h>

#define NAMESIZE 32

struct simp_st
{
	int i;
	float f;
	char ch;
};

int main()
{
// TYPE NAME = VALUE;

	struct simp_st a = {123,456.789,'a'};
	a.i = 112233;
	printf("%d %f %c\n",a.i,a.f,a.ch);
	exit(0);
}


book@100ask:~/C_coding/CH02$ make strct
cc     strct.c   -o strct


book@100ask:~/C_coding/CH02$ ./strct
112233 456.789001 a
book@100ask:~/C_coding/CH02$ cat struct.c
#include <stdio.h>
#include <stdlib.h>

#define NAMESIZE 32

struct simp_st
{
	int i;
	float f;
	char ch;
};

struct birthday_st
{
	int 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章