4회 ¶
-
{{{ }}}
.
¶
11. 탕, int* a; int b; int **c; 했 &c,c,*c,&a,a 해 하, 하 해할 해.
-포 포 . &c 하 c 포 a 합. *c한 a . &a a , a a b 키 b 합.12. 행 행하, 해 .
int* a;
int b=5;int* a;
int** c;
c=&a;
a=&b;
a=&b;
- *c=9;
printf("%d %d",*c,**c);
-해 : int형 형 키 포 a, b 5 , 포 키 c 하. a 포 c . b 포 a 할하. 포c 9 . a c 9 해 . 트 *c,**c 하 a 9 .
-형 큐 큐 큐 키 . F 키 R하 텅 F R 한 키 F,R 텅 할 . 해하 하 N N-1 하 . 하 하 하 . 하 해 하 해 .
- c char,int,float 형 , 포, 형 형 , 형 할 typedef 한. typedef #define 하 c 형 하 하 typedef 해 c파 해 . 한 #define 한 형태 환 하.
< 형 : typedef 형 형; >
:
#include <stdio.h>
void main()
{
#include <stdio.h>
void main()
{
typedef char *YOU;
YOU name ="color";
YOU color = "red, blue, yellow, black";
printf("name=%s \n",name);
printf("color=%s \n",color);
}YOU name ="color";
YOU color = "red, blue, yellow, black";
printf("name=%s \n",name);
printf("color=%s \n",color);
:
name =color
color =red, blue, yellow, black
name =color
color =red, blue, yellow, black
해 :
typedef 형 char 형 *YOU 했 YOU name 하 char *name .
4. 하 student 하 , student 0~3 AClass 학 히 , 해.
#include<stdio.h>
typedef 형 char 형 *YOU 했 YOU name 하 char *name .
char 해 , 학 int형 .
-.. ..#include<stdio.h>
struct Student
{
{
int age;
char name[];
char name[];
};
for(i=0;i<4;i++){
}
return 0;
}
}
-
황혜 ¶
8. 형태 .
8 패하 해 푸 . 해
1
3 2
4 5 6
10 9 8 7
11 12 13 14 15
21 20 19 18 17 16
hint) Dp = (int**)malloc(sizeof(int*));
8 패하 해 푸 . 해
1
3 2
4 5 6
10 9 8 7
11 12 13 14 15
21 20 19 18 17 16
#include <stdio.h> int main() { int a[6][6]; int i,j; int count=1; for(i=0;i<6;i++) { if(i%2!=0) { for(j=i;j>=0;j--) { a[i][j]=count; count++; } } else { for(j=0;j<=i;j++) { a[i][j]=count; count++; } } } for(i=0;i<6;i++) { for(j=0;j<=i;j++) { if(a[i][j]<10) printf("%d ",a[i][j]); else printf("%d ",a[i][j]); } printf("\n"); } return 0; }9.2포 하 3x3행 , 합 하 .
hint) Dp = (int**)malloc(sizeof(int*));
10.3회 10 해해 . 펙 해합. , 해
//10.LinearSearch 해. 1000 , random함 해 1 1000 , 777 .
&c : c
c : c (a )
*c : c키 (b )
&a : a
a : a (b )
c==&a
*c==a==&b
12. 행 행하, 해 .
int* a;
int b=5;
int** c;
c=&a; // c a
a=&b; // a b
**c=9; // c (?) 9
printf("%d %d",*c,**c); // *c a **c b .
//10.LinearSearch 해. 1000 , random함 해 1 1000 , 777 .
#include <stdio.h> #include <stdlib.h> #include <time.h> void random(int a[]); int main() { int x; int a[1000]; int i; srand(time(NULL)); for(i=0;i<1000;i++) { x=1+rand()%1000; a[i]=x; // printf("%d ",a[i]); } // printf("\n"); random(a); return 0; } void random(int a[]) { int find[1000]={0}; int i; for(i=0;i<1000;i++) { if(a[i]==777) find[i]=i; if(find[i]!=0) printf("777 %d \n",find[i]); } }11. 탕, int* a; int b; int **c; 했 &c,c,*c,&a,a 해 하, 하 해할 해.
&c : c
c : c (a )
*c : c키 (b )
&a : a
a : a (b )
c==&a
*c==a==&b
12. 행 행하, 해 .
int* a;
int b=5;
int** c;
c=&a; // c a
a=&b; // a b
**c=9; // c (?) 9
printf("%d %d",*c,**c); // *c a **c b .
Circular Queue .
- 하 형 하
typedef struct
{
- 큐 형 태.
- 형 큐 히 Front Rear index 하 Empty Full 할 .
typedef , 한 .- 형 큐 히 Front Rear index 하 Empty Full 할 .
- 하 형 하
typedef struct
{
char *name;
int age;
char sex;
}Student;int age;
char sex;
하 student 하 , student 0~3 AClass 학 히 , 해.
char 해 , 학 int형 .
해 , 해합.
char 해 , 학 int형 .
해 , 해합.
#include <stdio.h> typedef struct { char *name; int age; char sex; }Student; int main() { Student Std[4]; int i; Std[0].name=""; Std[0].age=24; Std[0].sex='F'; Std[1].name="희"; Std[1].age=24; Std[1].sex='F'; Std[2].name="한"; Std[2].age=23; Std[2].sex='F'; Std[3].name="황혜"; Std[3].age=22; Std[3].sex='F'; printf("\t\t\n"); for(i=0;i<4;i++) { printf("%s\t%d\t%c\n",Std[i].name,Std[i].age,Std[i].sex); } return 0; }
희 ¶
1~6. Koistudy.net 106~111
->!
7. Koistudy.net 125, 152( 하 힘 하) 3n+1
accept accept 패하 한 해 합^^
-> !
accept accept 패하 한 해 합^^
-> !
8. 형태 .
8 패하 해 푸 . 해
8 패하 해 푸 . 해
1 3 2 4 5 6 10 9 8 7 11 12 13 14 15 21 20 19 18 17 16 #include <stdio.h> int main(){ int i,j; int arr[6][6]={0,}; int num=0; for(i=0 ; i<6 ; i++){ if(i%2==0){ for(j=0 ; j<=i ; j++) arr[i][j]=++num; }else{ for(j=i ; j>=0 ; j--) arr[i][j]=++num; } } for(i=0 ; i<6 ; i++){ for(j=0 ; j<6 ; j++){ if(arr[i][j] != 0) printf("%3d",arr[i][j]); } printf("\n"); } return 0; }
9. 2포 하 3x3행 , 합 하 .
hint) Dp = (int**)malloc(sizeof(int*));
hint) Dp = (int**)malloc(sizeof(int*));
#include <stdio.h> #include <stdlib.h> #include <time.h> int main(){ int **p1; int **p2; int i,j; srand(time(NULL)); p1=(int**)malloc(sizeof(int*)*3); p2=(int**)malloc(sizeof(int*)*3); for(i=0 ; i<3 ; i++){ p1[i]=(int*)malloc(sizeof(int*)*3); p2[i]=(int*)malloc(sizeof(int*)*3); } for(i=0 ; i<3 ; i++){ for(j=0 ; j<3 ; j++){ p1[i][j]=1+rand()%9; p2[i][j]=1+rand()%9; } } for(i=0 ; i<3 ; i++){ for(j=0 ; j<3 ; j++){ printf("%3d",p1[i][j]); } printf("\n"); } printf("\n"); for(i=0 ; i<3 ; i++){ for(j=0 ; j<3 ; j++){ printf("%3d",p2[i][j]); } printf("\n"); } printf("\n"); for(i=0 ; i<3 ; i++){ for(j=0 ; j<3 ; j++){ p1[i][j]+=p2[i][j]; printf("%3d",p1[i][j]); } printf("\n"); } return 0; }
10. 3회 10 해해 . 펙 해합. , 해
LinearSearch 해. 1000 , random함 해 1 1000 , 777 . 행킬 ?
(rand()%1000 한 1 1000 .)
LinearSearch 해. 1000 , random함 해 1 1000 , 777 . 행킬 ?
(rand()%1000 한 1 1000 .)
#include <stdio.h> #include <stdlib.h> #include <time.h> int main(){ int arr[1000]; int i; int count=0; srand(time(NULL)); for(i=0 ; i<1000 ; i++){ arr[i]=rand()%1000; } for(i=0 ; i<1000 ; i++){ if(arr[i]==777){ printf("%d 777 \n",i+1); count++; } } printf("%d \n",count); if(count == 0){ printf("777\n"); } return 0; }
11. 탕, int* a; int b; int **c; 했 &c,c,*c,&a,a 해 하, 하 해할 해.
int* a; int b=10; int** c; a=&b; c=&a; printf("%d\n",a); //b printf("%d\n",&a); //a printf("%d\n",*a); //b printf("%d\n",b); //b printf("%d\n",&b); //b printf("%d\n",c); //a printf("%d\n",&c); //c printf("%d\n",*c); //b
12. 행 행하, 해 .
int* a; int b=5; int** c; c=&a; a=&b; **c=9; printf("%d %d",*c,**c);
b 9 함!
1. LinkedList node 하 , 형태 해한 .
2. Circular Queue .
형 큐 큐 (arrangement) 형 표하 큐 하 형태 큐 합.
큐 한 , 하 .
해하 , 해 하 .
해하 트 킴 하 . 했 하 .
형 큐 큐 (arrangement) 형 표하 큐 하 형태 큐 합.
큐 한 , 하 .
해하 , 해 하 .
해하 트 킴 하 . 했 하 .
3. typedef , 한 .
typedef 형 하 할 하
<typedef >
typedef <형> <>;
typedef 형 하 할 하
<typedef >
typedef <형> <>;
<typedef >
typedef int AA;
AA num=500;
typedef int AA;
AA num=500;
4. 하 student 하 , student 0~3 AClass 학 히 , 해.
char 해 , 학 int형 .
해 , 해합.
char 해 , 학 int형 .
해 , 해합.
#include <stdio.h> struct student{ char name[20]; int num; int age; }; int main(){ int i; struct student aclass[3]={{"",201001,24}, {"한",201002,23}, {"황혜",201003,22}}; for(i=0 ; i<3 ; i++){ printf("%s %d %d\n",aclass[i].name,aclass[i].num,aclass[i].age); } return 0; }
한 ¶
1~6 :D
10.3회 10 해해 . 펙 해합. , 해
10.3회 10 해해 . 펙 해합. , 해
#include<stdio.h> #include<stdlib.h> #include<time.h> int main(void){ int i,ran,arr[1000]={0}; srand(time(NULL)); for(i=0;i<1000;i++){ ran = 1+rand()%1000; } if(arr[i]==777){ printf("777I arr[%d] ",i); } else printf("777I ."); return 0; }
12. 행 행하, 해 .
int* a;
int b=5;
int** c;
int* a;
int b=5;
int** c;
c=&a;
a=&b;
a=&b;
- *c=9;
printf("%d %d",*c,**c);
1.LinkedList node 하 , 형태 해한 .
NODE*CreateNode(char name [])
{
NODE*NewNode = (NODE*)malloc(sizeof(NODE));
NODE*CreateNode(char name [])
{
NODE*NewNode = (NODE*)malloc(sizeof(NODE));
2. Circular Queue .
큐 하 택 하 . 할 크 태 overflow 하 크 하 , 0 해 한. 한 환형 해 통 환형큐(circular queue) 한
큐 하 택 하 . 할 크 태 overflow 하 크 하 , 0 해 한. 한 환형 해 통 환형큐(circular queue) 한
3. typedef , 한 .
1) 형 할 하
Typedef _형_ _형_;
) typedef unsigned char uchar;
2)헤파 typedef하
Typedef 통 하 헤파 해 파 할
//typedef 하 형 형 할 .
1) 형 할 하
Typedef _형_ _형_;
) typedef unsigned char uchar;
2)헤파 typedef하
Typedef 통 하 헤파 해 파 할
//typedef 하 형 형 할 .
#include<stdio.h> typedef int Num; int main(){ Num a=10; int b=20; printf("sum = %d\n",a+b); return 0; }
typedef 하 int char 형 하 하.
typedef 해. int형 NUM .
typedef 해. int형 NUM .
통 형 int 하 . NUM 한 , int 한 해 확하 .
4. 하 student 하 , student 0~3 AClass 학 히 , 해.
o char 해 , 학 int형 .
o 해 , 해합.
o char 해 , 학 int형 .
o 해 , 해합.
#include<stdio.h> #include<string.h> int main(void){ struct student{ char name[10]; int age; }; struct student s[4]; int i; strcpy(s[0].name,"한"); s[0].age = 23; strcpy(s[1].name,"희"); s[1].age = 24; strcpy(s[2].name,""); s[2].age = 24; strcpy(s[3].name,"황혜"); s[3].age = 22; for(i=0;i<4;i++){ printf(" : %s\n",s[i].name); printf(" : %d\n",s[i].age); } return 0; }