Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Tags
more
Archives
Today
Total
관리 메뉴

५✍

11.12 9일 복습 본문

비트 단기/c

11.12 9일 복습

suuuuu 2018. 11. 12. 21:46
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
#include "pch.h"
#include <iostream>
#include<time.h>
 
/*
//func32(new int[10]);
void func32(int *pp) {
    int *p = new int[10];
    for (int i = 0; i < 9; i++)
    {
        pp[i] = i;
        printf("%d ", pp[i]);
    }
    delete[] pp;
}
*/
 
/*
//delete[]func32(new int[5]);
void *func32(int *pp) {
    int *p = new int[10];
    for (int i = 0; i < 9; i++)
    {
        pp[i] = i;
        printf("%d ", pp[i]);
    }
    delete[] pp;
    return pp;
}
*/
 
/*
//func33();
void func33() {
    printf("1\n");
    return; //함수 중단 //1까지만 출력되고 2는 출력되지 않는다.
    printf("2\n");
}
*/
 
/*
//func34(10);
void func34(int n) {
    
    if (n < 0) //음수 라면,
    {
        printf("음수를 넣지 마세요");
        return; //이럴 때, 음수를 던지면 종료 
        printf("dsadf"); //도달할 수 없다
    }
    if (n % 2 == 0)
    {
        printf("짝수입니다");
    }
    else
    {
        printf("홀수입니다");
    }
}
*/
 
/*
//func35();
int func35() {
    int n = 4;
    if (n==3)
    {
        return 100; //return은 값을주는 역할, 함수를 중단시키는 역할 두가지 역할이 있다.
    }
    else
    {
        //printf("ads");    
        return 200;
    }
}
*/
 
/*
int func36(int n) {
    switch (n)
    {
    case 10:
        return n * 10;//switch에서 break 대신 return으로 사용
        //break를 사용하면 return값을 받을 수 없기에 무조건 return을 사용한다.
    case 20:
        return n * 20;
    case 30:
        return n * 30;
        break;
    case 40:
        return n * 40;
        
    }
}
*/
 
/*
//func37(); //1
//func37(); //1
//func37(); //1
void func37() {
    int count=0; //0부터 호출됨
    count++;
    printf("%d\n", count);
}
*/
 
/*
//func38(); //1
//func38(); //2
//func38(); //3
int count = 0;
void func38() {
    
    count++; //0에서++ //1에서++ //2에서++
    printf("%d\n", count);
}
*/
 
/*
//func39(); //1
//func39(); //2
//func39(); //3 
void func39() {
    static int count = 0; // static이 지역변수를 전역변수로 만든다. //38번과 같은 결과가 나옴
    //38번은 함수를 벗어나서 다른곳에서 사용할 수 있지만, 39번은 이함수 안에서만 사용가능(함수전용 전역변수)
    count++;
    printf("%d\n", count);
}
*/
 
/*
//func40();
void func40() {
    int a = 3;
    int b = a++; //대입먼저 그다음 증가
    int c = 3;
    int d = 3;
    printf("%d %d\n", a, b);
    printf("%d %d\n", c++, ++d);
    printf("%d %d\n\n", ++c, d++);
}
*/
 
/*
//func41();
void func41() {
    int a = 3;
    int b = ++a; //증가먼저 그다음 대입
    printf("%d %d\n", a, b);
}
*/
 
/*
//int main()안에 //int x = 3, y = 3; //func42(x++, ++y);
void func42(int a, int b) {
    printf("%d %d\n", a, b);
}
*/
 
/*
//func43(a,b);
int a = 10, b = 20;
void func43(int a, int b) {
    printf("%d %d\n", a, b);
    printf("%d %d\n", &a, &b);
}
*/
 
/*
//func44(7, 5);//x,y
void  func44(int x, int y) { //이중 for문 //(x,y)
    for (int a = 0; a < y; a++)
    {
        for (int b = 0; b < x; b++)
        {
            printf("(%d %d)", a, b);
        }
        printf("\n");
    }
}
*/
 
/*
//func45(7, 5);
//srand((signed)time(NULL));
void  func45(int x, int y) { //가로: x, cx, width, horizamtal  //세로: y, cy, height, vertical
    for (int a = 0; a < y; a++)
    {
        for (int b = 0; b < x; b++)
        {
            printf("%02d ", rand()%100);
        }
        printf("\n");
    }
}
*/
 
 
/*
void  func46() {
//ex1
    int a = 10;
    a = 20;
//ex2
    const int b = 20;
    //b=32; //b는 상수이므로 값을 받을 수 없다
//ex3
    int *c;
    c = new int;
    int *c;
//ex4
    int n = 100;
    const int *d=&n;
    //d=200; //*d는 상수이므로 값을 받을 수 없다
    d = new int;
//ex5
    int s = 100;
    int *const e = &s;//주소가 상수화 됨, 변경이 불가하다
    //e = new int;//주소가 상수화 되어서 오류
//ex6
    int t = 100;
    const int *const f = &t;
    //*f = 10;
    //f = 6;
//const가 앞에 붙은 경우, 값변경 불가
//const가 뒤에 붙은 경우, 주소변경 불가
//const가 앞, 뒤에 붙은 경우, 값변경 불가, 주소변경 불가
}
*/
 
/*
//srand((signed)time(NULL));
//int ar[] = { 1,2,3,4,5 };
//func47(ar);
void  func47(int *p) { //데이터 갱신 불가로 만들기 위해 int앞에 const를 붙인다 //int 와 *사이에 const를 붙이면 주소변경 불가.
    for (int i = 0; i < 5; i++)
    {
        int n = rand();
        if (n == 7777)
        {
            p[0] = 9999;
            printf("메롱");
        }
        printf("%d ", p[i]);
    }
}
*/
 
/*
//func48();
//fnc49(1, 3);
//func49(1, 3, 3);
void  func48(...){//"..."은 인수전달을 몇개 해야하는지 모를떄.
    printf("1\n");
}
void  func49(int a,int b,...) {//인수 2개 이상은 전달 해야한다.
    printf("1");
}
*/
 
/*
//func50();
void  func50() {
    printf("1\n");
    //int printf(char const* const _Format, ...);//ctrl+F12 함수 원형 //프로토타입
    //printf 앞에 int 가 있기에 return값이 있슴
    //함수 원형(char const* const _Format, ...) //(char* a, ...)ch타입의 주소를 받는다는 의미
    int n=printf("Apple");
    printf("\n%d\n", n);//printf는 return값이 있다. 실제로 안사용 했을 뿐
    printf("%d", printf("Applebanana"));
}
*/
 
/*
    //func51();
void  func51() {
    char ar[] = { 10,20,30,40,50,60,70};
    int size = sizeof(ar);
    memset(ar, 0, 4); //ar[4]까지 0으로 된다
    //memset 함수를 사용 함으로서 for문을 사용하지않고 빠르게 값을 넣을 수 있다.
    for (int i = 0; i < sizeof(ar); i++)
    {
        printf("%d ", ar[i]);
    }
}
*/
 
int main()
{
}
 
cs

'비트 단기 > c' 카테고리의 다른 글

11.14  (0) 2018.11.14
11.13  (0) 2018.11.13
11.8  (0) 2018.11.08
ㅇㅎ  (0) 2018.11.07
11.7  (0) 2018.11.07