정성훈
    struct_init.c (교재)
  https://itsys.hansung.ac.kr/cgi-bin/onlineTest/viewCcoding/onlineCcoding.cgi?source=src/chap11/struct_init.c



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
 
// 2차원 공간의 점을 구조체로 나타낸다.
struct point {
    int    x;
    int    y;
};  
    
int main(void)
{
 
    struct point p = { 1, 2 };      // ①
    struct point q = { .y = 2,.x = 1 }; // ②
    struct point r = p;         // ③
    r = (struct point) { 1, 2 };        // ④ C99 버전
 
    printf("p=(%d, %d) \n", p.x, p.y);
    printf("q=(%d, %d) \n", q.x, q.y);
    printf("r=(%d, %d) \n", r.x, r.y);
    return 0;
}
cs

  등록일 : 2022-02-23 [01:14] 조회 : 1357 다운 : 0   
 
△ 이전글point.c (교재)
▽ 다음글student1.c (교재)
C프로그래밍(프로그래밍언어) 실습게시판
번호 ⓒ 제 목
lMini Project (어드벤처 게임 만들기) 추가 구현 // ★★★ 기말과제 게임...
l실습 목차
252 └❶ lpointer_to_st.c (교재)
251 └❶ lvector.c (교재)
250 └❶ lmultiple_choice.c (교재)
249 └❶ larray_of_struct.c (교재)
248 └❶ lpoint.c (교재)
247 └❶ lstruct_init.c (교재)
246 └❶ lstudent1.c (교재)
245 (10장) 문자열
244 └❶ Mini Project 2(텍스트 압축)©
243    └❷ Mini Project 2(텍스트 압축) (모범 답안)
242       └❸ Mini Project 2(텍스트 압축 해제) 추가 구현
241 └❶ Mini Project 1(텍스트 암호화)©
240    └❷ Mini Project 1(텍스트 암호화) (모범 답안)
239 └❶ 도전문제
238    └❷ 도전문제 (모범 답안)
237 └❶ lstr_sort.c (교재)
236    └❷ 한글 이름 정렬 예제
235 └❶ ldic.c (교재)
234 └❶ larray_of_string.c (교재)
233 └❶ lanagram.c (교재)

[1][2][3][4][5][6][7][8][9][10][11][12][13][14][15]