공머씨의 블로그
내가 실습한 c언어 7. 35~ 본문
반응형
// c언어 코딩036 구조체 선언과 초기화
#include <stdio.h>
struct Book
{
char title[20];
char author[20];
int series;
};
typedef struct Book Book;
int main(void)
{
Book b1 = { "태백산맥","조정래",10 }, b2={ "토지","박경림",20 };
puts("------------------");
puts("*구조체 출력*");
puts("------------------");
pritnf("b1:%10s %10s %4d권 \n", b1.title, b1.author, b1.series);
printf("b2:%10s %10s %4d권 \n", b2.title, b2.author, b2.series);
puts("------------------");
puts("b1.title에서 .d는 멤버접근 연산자");
puts("------------------");
return 0;
}
반응형
'내가 공부한 3학기 전공 > 내가 실습한 C언어' 카테고리의 다른 글
내가 실습한 c언어 6. 30~35 (0) | 2020.03.15 |
---|---|
내가 실습한 c언어 5. 26~29 (0) | 2020.03.15 |
내가 실습한 c언어 4. 23~25 (0) | 2020.03.15 |
내가 실습한 c언어 3. 16~22 (0) | 2020.03.15 |
내가 실습한 c언어 2 12~15 (0) | 2020.03.13 |
Comments