From 95a6c8873f7383738de6d4e97d8095e8a278723f Mon Sep 17 00:00:00 2001 From: "Hwanyong Lee-pcc000 (SSH)" <hwan@ajou.ac.kr> Date: Wed, 15 Feb 2023 11:27:51 +0900 Subject: [PATCH] Lab08 before --- lab03/aaa | 1 + lab03/add | Bin 16888 -> 0 bytes lab03/add.c | 1 + lab03/add.o | Bin 0 -> 2136 bytes lab03/add.s | 95 ++++++ lab03/all | 2 - lab03/errfile | 1 - lab03/fadd.c | 4 + lab03/fadd.o | Bin 0 -> 1376 bytes lab03/gen | Bin 16888 -> 0 bytes lab03/gen.c | 3 +- lab03/gen.i | 759 +++++++++++++++++++++++++++++++++++++++++++++ lab03/gen.o | Bin 0 -> 2080 bytes lab03/gen.s | 81 +++++ lab03/infile | 1 - lab03/lserr | 3 - lab03/teeout | 1 - lab03/tlserr | 4 - lab04/func.c | 8 + lab04/func.h | 3 + lab04/func.o | Bin 0 -> 1480 bytes lab04/gen.c | 13 + lab04/gen.o | Bin 0 -> 2072 bytes lab04/main.c | 18 ++ lab04/main.o | Bin 0 -> 2208 bytes lab04/mem_test.c | 12 + lab04/tobin.c | 10 + lab04/tobin.o | Bin 0 -> 1472 bytes lab05/func.c | 8 + lab05/func.h | 4 + lab05/gen.c | 13 + lab05/main.c | 21 ++ lab05/mem_test.c | 23 ++ lab05/test.c | 21 ++ lab05/tobin.c | 10 + lab06/const_test.c | 16 + lab07/funcp.c | 36 +++ lab07/po2.c | 19 ++ lab07/pointer.c | 22 ++ 39 files changed, 1200 insertions(+), 13 deletions(-) create mode 100644 lab03/aaa delete mode 100755 lab03/add create mode 100644 lab03/add.o create mode 100644 lab03/add.s delete mode 100644 lab03/all delete mode 100644 lab03/errfile create mode 100644 lab03/fadd.c create mode 100644 lab03/fadd.o delete mode 100755 lab03/gen create mode 100644 lab03/gen.i create mode 100644 lab03/gen.o create mode 100644 lab03/gen.s delete mode 100644 lab03/infile delete mode 100644 lab03/lserr delete mode 100644 lab03/teeout delete mode 100644 lab03/tlserr create mode 100644 lab04/func.c create mode 100644 lab04/func.h create mode 100644 lab04/func.o create mode 100644 lab04/gen.c create mode 100644 lab04/gen.o create mode 100644 lab04/main.c create mode 100644 lab04/main.o create mode 100644 lab04/mem_test.c create mode 100644 lab04/tobin.c create mode 100644 lab04/tobin.o create mode 100644 lab05/func.c create mode 100644 lab05/func.h create mode 100644 lab05/gen.c create mode 100644 lab05/main.c create mode 100644 lab05/mem_test.c create mode 100644 lab05/test.c create mode 100644 lab05/tobin.c create mode 100644 lab06/const_test.c create mode 100644 lab07/funcp.c create mode 100644 lab07/po2.c create mode 100644 lab07/pointer.c diff --git a/lab03/aaa b/lab03/aaa new file mode 100644 index 0000000..b4de394 --- /dev/null +++ b/lab03/aaa @@ -0,0 +1 @@ +11 diff --git a/lab03/add b/lab03/add deleted file mode 100755 index f2d0aaaba1eee7fbf1ed109b172305b70a5d8784..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16888 zcmb<-^>JfjWMqH=W(GS35buBhM8p9?F<4kZ84L^z4h$9yybKNu@(gkeYzzzxEMPH+ zJWM@|zQF_$htV7mE(0@Ep9F}(z`%e`%Rtq^XpoygLLeGsABc?&Yp_E^VKf8OA0U0K zASoyxCJv*YLfr|YVd5ZtVEYt6ni&`v(C7k?0tN;K7>%qC6gCTVA^H~BqS6IW`zAnX zm_85}q;CUM-v+2Y82tfiAB={DC&-N;Yyk~VbQ;as4CwkIp!(2h7l^YNU^K`MkWlc` zk`xdd-5wYpmwf?HeJW4|=rqh87!9%mWMAOZk`z$5fY`)fSTqMg?ZXuh37`OHU|@jJ z(BNgz&&f<OGttjU(ap)sE3MG2urSj#Gtn!~*E0fJ4{{gC4p5qM_X}lUVqiD`5`zXK zI8TT$Fo4rJNIty%pZ1|E_k_0ePA`m8`2E{SUUD)>J;)4@ogg(JgF*VCP6Ba3<}z?H zFo5$U*#C@;AaN#;7#9Nr!^PBdxt5>0Vc7&Ehk`+>p+SuzF2%sWAcP_U;b`L!_s1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F#!<1zpM1RVC0 diff --git a/lab03/add.c b/lab03/add.c index 7c112f6..74c4639 100644 --- a/lab03/add.c +++ b/lab03/add.c @@ -1,4 +1,5 @@ #include <stdio.h> +/* 이환용 이 짰어요 */ int main() { diff --git a/lab03/add.o b/lab03/add.o new file mode 100644 index 0000000000000000000000000000000000000000..c150cb7fcb215dea0cc34fdcc630e5d0cfa5981a GIT binary patch literal 2136 zcmb<-^>JfjWMqH=Mg}_u1P><4z;J^F!FB*M9T@l+co{zP%l!)V=zQwY{6-<gqnkxl zgMop;qto?=;eq3>UqA{ydP6^W^t!(B=sf1pYYP(D0U}<2h)&lp&9z_tm-u(PzOm(3 zXJ9DtXs-RjRHEe3%?gtD=sdVfh=GA&AIM2i-C&KcrMpAlbi00Fynw~j*F6(nGfwDs z{nGq`$)nr%M~a6r57=ELtYFP2538mqsHQM@<`tBdD1?;fEBKY>CZ!e?b1|r<C~z?_ zxH~&rDQJWymFAU{Dp=~7=o#o5mV$YPbw&ny1}1ujnh<dYP_PIvFff3e>+ToIz{J3C z03^l?ay|nCg9wyntO{aatPo(7=3(cUz{tQL!vMh`>1`mwl~16J$(fgpX)O;s2S@-r z1_cBQ!^i*FWSOzX90LP01I#t3x|qSPM->C{n8CgQu~0EH13Rh!l*i0~-NDQZoKO|0 z6f*-GssIB6*kmCj_k+WPfq{XCfq?-OzUUg1aEKe?5Vyb~ZjVFU4Tm^GVoHi$GDB`+ zW*$SlyN|z<qfflQn_IAJNPLK+laFgWLwtN@aelI;WqfgRVqO|UaY;&QQ4vF0c~NFb zDnmh0W?o4eLwtO3Nn&z#d~!y1d|F~=4g-S$)PqdWwDjjc1Xw}EL1_vU7BKNBs5nSH zF9QPuOgs-s9F!(O@*tsN5W&Czj&VLD^=(jbkUEfhQ7C@`lm^+$kEDJBk~k<{VD>6N z#X;tPFqF%{pjTX(TauW>pjTW{1fervtfJJMM7@&KiV_CBl*E!m2EC->Vg|jUd<Z8w zKQ}iuuY^G_FTW&J&)qLn7aV3#etKT1UO`cQL26M+C4(N=q|}V~w4%h^RJhfYFhKqR z<u&w_3Mu;-7+~oWW(P<uj18itp<xYE4-y064ro?90OBw(FmN+4fKxpz2T4H1)u7@~ z<xo)uhHr2dDg)hq9R>z)t|V7KC?A2$M2SlVg#B`;)`R_kEMy6FKP+9t<U~M*GB7ZJ z+y@f_(NJNyIZjahAUS0008@x8h(&D>v`j&FKTJO;evyrUg+ELz3u-31{sgG~pz;K! z7DS`#2c<$#-a(Il50D@O0|P9cLGceNC1Ltu;vj3#?FQL110=z~zyPB`Wdav8u0irJ p{U9^Z;~pe$02K@eagZ?7Sh$EF1E}7BbK#5xsQXLcA`k|;egLK*<VXMj literal 0 HcmV?d00001 diff --git a/lab03/add.s b/lab03/add.s new file mode 100644 index 0000000..b0c75b5 --- /dev/null +++ b/lab03/add.s @@ -0,0 +1,95 @@ + .file "add.c" + .text + .section .rodata +.LC0: + .string "%d %d" +.LC1: + .string "Input Two Numbers\n" +.LC2: + .string "%d \n" + .text + .globl main + .type main, @function +main: +.LFB0: + .cfi_startproc + endbr64 + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + subq $32, %rsp + movq %fs:40, %rax + movq %rax, -8(%rbp) + xorl %eax, %eax + movl $0, -12(%rbp) +.L7: + leaq -16(%rbp), %rdx + leaq -20(%rbp), %rax + movq %rax, %rsi + leaq .LC0(%rip), %rdi + movl $0, %eax + call __isoc99_scanf@PLT + movl %eax, -12(%rbp) + cmpl $-1, -12(%rbp) + je .L10 + movl -20(%rbp), %eax + cmpl $9999, %eax + je .L11 + cmpl $2, -12(%rbp) + je .L5 + movq stderr(%rip), %rax + movq %rax, %rcx + movl $18, %edx + movl $1, %esi + leaq .LC1(%rip), %rdi + call fwrite@PLT + jmp .L6 +.L5: + movl -20(%rbp), %edx + movl -16(%rbp), %eax + addl %edx, %eax + movl %eax, %esi + leaq .LC2(%rip), %rdi + movl $0, %eax + call printf@PLT +.L6: + jmp .L7 +.L10: + nop + jmp .L3 +.L11: + nop +.L3: + movl -12(%rbp), %eax + subl $2, %eax + movq -8(%rbp), %rcx + xorq %fs:40, %rcx + je .L9 + call __stack_chk_fail@PLT +.L9: + leave + .cfi_def_cfa 7, 8 + ret + .cfi_endproc +.LFE0: + .size main, .-main + .ident "GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0" + .section .note.GNU-stack,"",@progbits + .section .note.gnu.property,"a" + .align 8 + .long 1f - 0f + .long 4f - 1f + .long 5 +0: + .string "GNU" +1: + .align 8 + .long 0xc0000002 + .long 3f - 2f +2: + .long 0x3 +3: + .align 8 +4: diff --git a/lab03/all b/lab03/all deleted file mode 100644 index 6f27d2d..0000000 --- a/lab03/all +++ /dev/null @@ -1,2 +0,0 @@ -STDOUT: 100 -STDERR: 100 diff --git a/lab03/errfile b/lab03/errfile deleted file mode 100644 index b22717b..0000000 --- a/lab03/errfile +++ /dev/null @@ -1 +0,0 @@ -STDERR: 666 diff --git a/lab03/fadd.c b/lab03/fadd.c new file mode 100644 index 0000000..db726c4 --- /dev/null +++ b/lab03/fadd.c @@ -0,0 +1,4 @@ +int fadd(int a, int b) +{ + return a+b; +} diff --git a/lab03/fadd.o b/lab03/fadd.o new file mode 100644 index 0000000000000000000000000000000000000000..b9c87826c2f72e1c767bc5771a5fdfacbdb6b268 GIT binary patch literal 1376 zcmb<-^>JfjWMqH=Mg}_u1P><4z>vU%U^{@B4h%dD+zg-j<$i^FbUy8@{nJ_cqdW9Z zx9bna3$ce8+?}1R6f{DUO7lue6)g2k^bB+jOTj$DIwJ!;0~0+%O^7(yG!_O11_1^J z237_J26w+u1||lE10XSGuq*?E2$W{53SwZa5MY$%Vdt2@$iN`O0Kp(>2@v7RC(y>^ z%**D_!_EQX<G>(4vM_x7k4>5xYX~qfFoRr$MFTSf%$2B;%wXT3ih+2{3~V3@12Z$Q zV~BwSm>EDJ0b(IA$ZtYO?gaZCB%PL+lA@Q)0HQ!#1rWi&0CqW26f!XA6<6k#BqlNF z6_*r2=nNREB(<W1K`$k-B#}WcskoRyFF8LqH#M(>K`$@ABvsGdFI2a<Br!P~%1_TL z)hj5<FGwvasbtVAO3g{sOU;N+D@x2wg<4JlCC$J9_9c3VLDC=t1Ki(GJ3#RYWr8V1 zsDAVqiU7-E66pHX85kHqVNI@n9jN^VXjZ}O2gxH#!R&|8rcnLJYC!B35P=25^ueTD z85qE+3MK9t7#KRB3Sj92$_4us#s<-`Q2WvKuK-ChFfdp^X&40xD;OI@gZv3fy|DNK ziGlC~s6%1##|d>OOg~H<qzv6|uznE1z`*bUN^>zVFo4WJ*AEgyk2{c-3m}6T7#Mg# h93%`ChKmR?fbu<@3upX*DolrqKp0SA2#0}z0RRd|RvG{R literal 0 HcmV?d00001 diff --git a/lab03/gen b/lab03/gen deleted file mode 100755 index 814d2160f3e3e5eb848bac0ed720ebe432ac627d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16888 zcmb<-^>JfjWMqH=W(GS35buBhM8p9?F<4kZ84L^z4h$9yybKNu@(gkeYzzzxEMPH+ zJWM@|zQF_$htV7mE(0@Ep9F}(z`%e`%Rtq^XpoygLLeGsABc?&Yp_E^VKf8OA0U0K zASoyxCJv*oLfr|YVd5ZtVEYt6ni&`v(C7q^0tN;K7>%qC6gCTVA^H~BqS6IW`x>A$ zOdp5~(zgMsZv#{xjQ#+%4@Sen6XZq^wt$8wI*sOR26TN9P<`mM3&hzBFdAeBNGSMe zNeYOKZV!x)%f0}pJ`tz_bQ)$4j0V{OvM=yyNeU=jKx|?#ESiI$_Th?$1W<s3;txtg zgO@=+Co{>+L_a4*HzzZ%v_iMS!c5o9M6Wns&j@Ti$Xy^iKxxX|FO-3af#Cp13>u8! zJR!os08Zy1`8m&X?DHZmw3pUKlzi2%)S0yD$bFD{kQpF5L25t-gY-k40^)+qW#D9B z0Ov`F{~H+?7zMy$AO#w-Ju(+l&*g&H*l-h4l0}x6VqjnpLKc9swQ-0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2894 100644 --- a/lab03/gen.c +++ b/lab03/gen.c @@ -1,4 +1,5 @@ #include <stdio.h> +#define AA 9999 int main() { @@ -8,7 +9,7 @@ int main() while(1) { scret = scanf("%d %d", &a, &b); - if (scret == EOF || a== 9999) + if (scret == EOF || a== AA) break; printf("%d %d ", a, b); } diff --git a/lab03/gen.i b/lab03/gen.i new file mode 100644 index 0000000..c2ee1cf --- /dev/null +++ b/lab03/gen.i @@ -0,0 +1,759 @@ +# 1 "gen.c" +# 1 "<built-in>" +# 1 "<command-line>" +# 31 "<command-line>" +# 1 "/usr/include/stdc-predef.h" 1 3 4 +# 32 "<command-line>" 2 +# 1 "gen.c" +# 1 "/usr/include/stdio.h" 1 3 4 +# 27 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 1 3 4 +# 33 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 3 4 +# 1 "/usr/include/features.h" 1 3 4 +# 461 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4 +# 452 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 453 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/long-double.h" 1 3 4 +# 454 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4 +# 462 "/usr/include/features.h" 2 3 4 +# 485 "/usr/include/features.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4 +# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4 +# 486 "/usr/include/features.h" 2 3 4 +# 34 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 2 3 4 +# 28 "/usr/include/stdio.h" 2 3 4 + + + + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h" 1 3 4 +# 209 "/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h" 3 4 + +# 209 "/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h" 3 4 +typedef long unsigned int size_t; +# 34 "/usr/include/stdio.h" 2 3 4 + + +# 1 "/usr/lib/gcc/x86_64-linux-gnu/9/include/stdarg.h" 1 3 4 +# 40 "/usr/lib/gcc/x86_64-linux-gnu/9/include/stdarg.h" 3 4 +typedef __builtin_va_list __gnuc_va_list; +# 37 "/usr/include/stdio.h" 2 3 4 + +# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4 +# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4 +# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/timesize.h" 1 3 4 +# 29 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + + +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; + +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; + + + + + + +typedef __int8_t __int_least8_t; +typedef __uint8_t __uint_least8_t; +typedef __int16_t __int_least16_t; +typedef __uint16_t __uint_least16_t; +typedef __int32_t __int_least32_t; +typedef __uint32_t __uint_least32_t; +typedef __int64_t __int_least64_t; +typedef __uint64_t __uint_least64_t; + + + +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; + + + + + + + +typedef long int __intmax_t; +typedef unsigned long int __uintmax_t; +# 141 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4 +# 142 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/time64.h" 1 3 4 +# 143 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4 + + +typedef unsigned long int __dev_t; +typedef unsigned int __uid_t; +typedef unsigned int __gid_t; +typedef unsigned long int __ino_t; +typedef unsigned long int __ino64_t; +typedef unsigned int __mode_t; +typedef unsigned long int __nlink_t; +typedef long int __off_t; +typedef long int __off64_t; +typedef int __pid_t; +typedef struct { int __val[2]; } __fsid_t; +typedef long int __clock_t; +typedef unsigned long int __rlim_t; +typedef unsigned long int __rlim64_t; +typedef unsigned int __id_t; +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; + +typedef int __daddr_t; +typedef int __key_t; + + +typedef int __clockid_t; + + +typedef void * __timer_t; + + +typedef long int __blksize_t; + + + + +typedef long int __blkcnt_t; +typedef long int __blkcnt64_t; + + +typedef unsigned long int __fsblkcnt_t; +typedef unsigned long int __fsblkcnt64_t; + + +typedef unsigned long int __fsfilcnt_t; +typedef unsigned long int __fsfilcnt64_t; + + +typedef long int __fsword_t; + +typedef long int __ssize_t; + + +typedef long int __syscall_slong_t; + +typedef unsigned long int __syscall_ulong_t; + + + +typedef __off64_t __loff_t; +typedef char *__caddr_t; + + +typedef long int __intptr_t; + + +typedef unsigned int __socklen_t; + + + + +typedef int __sig_atomic_t; +# 39 "/usr/include/stdio.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h" 1 3 4 + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h" 1 3 4 +# 13 "/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h" 3 4 +typedef struct +{ + int __count; + union + { + unsigned int __wch; + char __wchb[4]; + } __value; +} __mbstate_t; +# 6 "/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h" 2 3 4 + + + + +typedef struct _G_fpos_t +{ + __off_t __pos; + __mbstate_t __state; +} __fpos_t; +# 40 "/usr/include/stdio.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h" 1 3 4 +# 10 "/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h" 3 4 +typedef struct _G_fpos64_t +{ + __off64_t __pos; + __mbstate_t __state; +} __fpos64_t; +# 41 "/usr/include/stdio.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types/__FILE.h" 1 3 4 + + + +struct _IO_FILE; +typedef struct _IO_FILE __FILE; +# 42 "/usr/include/stdio.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types/FILE.h" 1 3 4 + + + +struct _IO_FILE; + + +typedef struct _IO_FILE FILE; +# 43 "/usr/include/stdio.h" 2 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h" 1 3 4 +# 35 "/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h" 3 4 +struct _IO_FILE; +struct _IO_marker; +struct _IO_codecvt; +struct _IO_wide_data; + + + + +typedef void _IO_lock_t; + + + + + +struct _IO_FILE +{ + int _flags; + + + char *_IO_read_ptr; + char *_IO_read_end; + char *_IO_read_base; + char *_IO_write_base; + char *_IO_write_ptr; + char *_IO_write_end; + char *_IO_buf_base; + char *_IO_buf_end; + + + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + int _flags2; + __off_t _old_offset; + + + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + _IO_lock_t *_lock; + + + + + + + + __off64_t _offset; + + struct _IO_codecvt *_codecvt; + struct _IO_wide_data *_wide_data; + struct _IO_FILE *_freeres_list; + void *_freeres_buf; + size_t __pad5; + int _mode; + + char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; +}; +# 44 "/usr/include/stdio.h" 2 3 4 +# 52 "/usr/include/stdio.h" 3 4 +typedef __gnuc_va_list va_list; +# 63 "/usr/include/stdio.h" 3 4 +typedef __off_t off_t; +# 77 "/usr/include/stdio.h" 3 4 +typedef __ssize_t ssize_t; + + + + + + +typedef __fpos_t fpos_t; +# 133 "/usr/include/stdio.h" 3 4 +# 1 "/usr/include/x86_64-linux-gnu/bits/stdio_lim.h" 1 3 4 +# 134 "/usr/include/stdio.h" 2 3 4 + + + +extern FILE *stdin; +extern FILE *stdout; +extern FILE *stderr; + + + + + + +extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)); + +extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __attribute__ ((__nothrow__ , __leaf__)); +# 173 "/usr/include/stdio.h" 3 4 +extern FILE *tmpfile (void) ; +# 187 "/usr/include/stdio.h" 3 4 +extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ; +# 204 "/usr/include/stdio.h" 3 4 +extern char *tempnam (const char *__dir, const char *__pfx) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ; + + + + + + + +extern int fclose (FILE *__stream); + + + + +extern int fflush (FILE *__stream); +# 227 "/usr/include/stdio.h" 3 4 +extern int fflush_unlocked (FILE *__stream); +# 246 "/usr/include/stdio.h" 3 4 +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) ; + + + + +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) ; +# 279 "/usr/include/stdio.h" 3 4 +extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ; +# 292 "/usr/include/stdio.h" 3 4 +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__)); + + + + +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __attribute__ ((__nothrow__ , __leaf__)); + + +extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + + +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...); + + + + +extern int printf (const char *__restrict __format, ...); + +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__)); + + + + + +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg); + + + + +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); + +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __attribute__ ((__nothrow__)); + + + +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))); +# 379 "/usr/include/stdio.h" 3 4 +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + + + + + + + +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) ; + + + + +extern int scanf (const char *__restrict __format, ...) ; + +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__)); + + + + + + +extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") + + ; +extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") + ; +extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__)) + + ; +# 432 "/usr/include/stdio.h" 3 4 +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) ; + + + + + +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) ; + + +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0))); + + + + +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf") + + + + __attribute__ ((__format__ (__scanf__, 2, 0))) ; +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf") + + __attribute__ ((__format__ (__scanf__, 1, 0))) ; +extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__)) + + + + __attribute__ ((__format__ (__scanf__, 2, 0))); +# 485 "/usr/include/stdio.h" 3 4 +extern int fgetc (FILE *__stream); +extern int getc (FILE *__stream); + + + + + +extern int getchar (void); + + + + + + +extern int getc_unlocked (FILE *__stream); +extern int getchar_unlocked (void); +# 510 "/usr/include/stdio.h" 3 4 +extern int fgetc_unlocked (FILE *__stream); +# 521 "/usr/include/stdio.h" 3 4 +extern int fputc (int __c, FILE *__stream); +extern int putc (int __c, FILE *__stream); + + + + + +extern int putchar (int __c); +# 537 "/usr/include/stdio.h" 3 4 +extern int fputc_unlocked (int __c, FILE *__stream); + + + + + + + +extern int putc_unlocked (int __c, FILE *__stream); +extern int putchar_unlocked (int __c); + + + + + + +extern int getw (FILE *__stream); + + +extern int putw (int __w, FILE *__stream); + + + + + + + +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + ; +# 603 "/usr/include/stdio.h" 3 4 +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) ; + + + + + + + +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) ; + + + + + + + +extern int fputs (const char *__restrict __s, FILE *__restrict __stream); + + + + + +extern int puts (const char *__s); + + + + + + +extern int ungetc (int __c, FILE *__stream); + + + + + + +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; + + + + +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s); +# 673 "/usr/include/stdio.h" 3 4 +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) ; +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream); + + + + + + + +extern int fseek (FILE *__stream, long int __off, int __whence); + + + + +extern long int ftell (FILE *__stream) ; + + + + +extern void rewind (FILE *__stream); +# 707 "/usr/include/stdio.h" 3 4 +extern int fseeko (FILE *__stream, __off_t __off, int __whence); + + + + +extern __off_t ftello (FILE *__stream) ; +# 731 "/usr/include/stdio.h" 3 4 +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos); + + + + +extern int fsetpos (FILE *__stream, const fpos_t *__pos); +# 757 "/usr/include/stdio.h" 3 4 +extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + +extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + +extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + +extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + + + + +extern void perror (const char *__s); + + + + + +# 1 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 1 3 4 +# 26 "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h" 3 4 +extern int sys_nerr; +extern const char *const sys_errlist[]; +# 782 "/usr/include/stdio.h" 2 3 4 + + + + +extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + + + +extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; +# 800 "/usr/include/stdio.h" 3 4 +extern FILE *popen (const char *__command, const char *__modes) ; + + + + + +extern int pclose (FILE *__stream); + + + + + +extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__)); +# 840 "/usr/include/stdio.h" 3 4 +extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); + + + +extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ; + + +extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)); +# 858 "/usr/include/stdio.h" 3 4 +extern int __uflow (FILE *); +extern int __overflow (FILE *, int); +# 873 "/usr/include/stdio.h" 3 4 + +# 2 "gen.c" 2 + + + +# 4 "gen.c" +int main() +{ + int a,b; + int scret=0; + setvbuf( +# 8 "gen.c" 3 4 + stdout +# 8 "gen.c" + , +# 8 "gen.c" 3 4 + ((void *)0) +# 8 "gen.c" + , +# 8 "gen.c" 3 4 + 1 +# 8 "gen.c" + ,5); + while(1) + { + scret = scanf("%d %d", &a, &b); + if (scret == +# 12 "gen.c" 3 4 + (-1) +# 12 "gen.c" + || a== 9999) + break; + printf("%d %d ", a, b); + } + return scret; +} diff --git a/lab03/gen.o b/lab03/gen.o new file m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yy^MVOaRX_*qc<(e*n( z^;^IcLTPmUpi~ITYv}PW01{+iV1UIlDE>jEAxu9^9Api;-5{$fKoSfL3^SlKs2t>i y#x+PDrXOS`dfbEL1)zek@&F_T!cgNtOfVK?0M!p*CJLbeb$<zpC?u^S3jqM+Pt;rh literal 0 HcmV?d00001 diff --git a/lab03/gen.s b/lab03/gen.s new file mode 100644 index 0000000..36d77fe --- /dev/null +++ b/lab03/gen.s @@ -0,0 +1,81 @@ + .file "gen.c" + .text + .section .rodata +.LC0: + .string "%d %d" +.LC1: + .string "%d %d " + .text + .globl main + .type main, @function +main: +.LFB0: + .cfi_startproc + endbr64 + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + subq $32, %rsp + movq %fs:40, %rax + movq %rax, -8(%rbp) + xorl %eax, %eax + movl $0, -12(%rbp) + movq stdout(%rip), %rax + movl $5, %ecx + movl $1, %edx + movl $0, %esi + movq %rax, %rdi + call setvbuf@PLT +.L3: + leaq -16(%rbp), %rdx + leaq -20(%rbp), %rax + movq %rax, %rsi + leaq .LC0(%rip), %rdi + movl $0, %eax + call __isoc99_scanf@PLT + movl %eax, -12(%rbp) + cmpl $-1, -12(%rbp) + je .L2 + movl -20(%rbp), %eax + cmpl $9999, %eax + je .L2 + movl -16(%rbp), %edx + movl -20(%rbp), %eax + movl %eax, %esi + leaq .LC1(%rip), %rdi + movl $0, %eax + call printf@PLT + jmp .L3 +.L2: + movl -12(%rbp), %eax + movq -8(%rbp), %rcx + xorq %fs:40, %rcx + je .L5 + call __stack_chk_fail@PLT +.L5: + leave + .cfi_def_cfa 7, 8 + ret + .cfi_endproc +.LFE0: + .size main, .-main + .ident "GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0" + .section .note.GNU-stack,"",@progbits + .section .note.gnu.property,"a" + .align 8 + .long 1f - 0f + .long 4f - 1f + .long 5 +0: + .string "GNU" +1: + .align 8 + .long 0xc0000002 + .long 3f - 2f +2: + .long 0x3 +3: + .align 8 +4: diff --git a/lab03/infile b/lab03/infile deleted file mode 100644 index ebc4bdc..0000000 --- a/lab03/infile +++ /dev/null @@ -1 +0,0 @@ -100 200 300 diff --git a/lab03/lserr b/lab03/lserr deleted file mode 100644 index cd854aa..0000000 --- a/lab03/lserr +++ /dev/null @@ -1,3 +0,0 @@ -ls: cannot access 'infile': No such file or directory -ls: cannot access 'infile': No such file or directory -ls: cannot access 'infile': No such file or directory diff --git a/lab03/teeout b/lab03/teeout deleted file mode 100644 index 1746327..0000000 --- a/lab03/teeout +++ /dev/null @@ -1 +0,0 @@ -200 200 300 300 \ No newline at end of file diff --git a/lab03/tlserr b/lab03/tlserr deleted file mode 100644 index 7630549..0000000 --- a/lab03/tlserr +++ /dev/null @@ -1,4 +0,0 @@ -This is ls ERROR mew -ls: cannot access 'infile': No such file or directory -ls: cannot access 'infile': No such file or directory -ls: cannot access 'infile': No such file or directory diff --git a/lab04/func.c b/lab04/func.c new file mode 100644 index 0000000..827bd92 --- /dev/null +++ b/lab04/func.c @@ -0,0 +1,8 @@ +#include "func.h" + +int func1(int a){ + return a*10; +} +int func2(int a){ + return a*2; +} diff --git a/lab04/func.h b/lab04/func.h new file mode 100644 index 0000000..65c565a --- /dev/null +++ b/lab04/func.h @@ -0,0 +1,3 @@ +#define DF(a) ((a)*(a)) + +extern int func1(int x); diff --git a/lab04/func.o b/lab04/func.o new file mode 100644 index 0000000000000000000000000000000000000000..f6e39705b8e0fda6b53d4e786895527af3494730 GIT binary patch literal 1480 zcmb<-^>JfjWMqH=Mg}_u1P><4z;J>I!FB*M9T<2RxEVh4%l!)V=zQ8)`=>kfPv?b$ z511G)Fdm3Kj4a{$2PDGa?(A%(pb?r>npaY)V5w)KXP|3X3g#Ks85!sqnCKa5Lc|#u zSQr=>1Q-|?SQ!`?-2Flsm>3uifW(-=b~7-DKxxLRAO^+?0Y+&ac8&>*3=A?15Db!* z1QD)$0&PsryleqH>>N-z8<02y1A`EVhRJ(E<UvB%Fepq|7(V{TCdZ65#26TuL9WK4 zftdm33sgyFuy0YtKs;s!HV}n@nHktI#6SYf;LroH5E$flAtZN#!-j!@fe#!Gj0`Y7 zI7~p=(n|A^^^zGtlp&Zj0*NvxfJp|h&ybP?10+o##9`(!=oMGymLw)I=oOa~LFfz^ zt0c9egh4MQu_Tc}FR8egK`%K!H#aq}gh4Maza&-9-7i$PxFj(-8_G}5E7dC~$}dPQ zDyd}9D@x5t)Jx5XPb*5yO@%s&0!o^J0USE$Ar14FHk#R>^nfg+2-S}sv)Raskl5(@ z)fpHVKygH_ejTX&21s^*m@xZ6@*qA8!|aFArcnJbc^Ew%#z3QC`e4GY3=H7Zh@2)s zax*{#0|PwWK)GPQ!q^}>7HU7b{v9Am1_p)*C=H`PVFhD@XplUpe1OFlNDPDxpa#Oi zg%j#dn0^V6A{=&uqy(TI<$%&$3=9k)Gtl*e#L(joq+bGRKdih0iGeWGI1m$z1sOo) T1(=CKBtZ42qliM%DzXp&X2D`) literal 0 HcmV?d00001 diff --git a/lab04/gen.c b/lab04/gen.c new file mode 100644 index 0000000..392c697 --- /dev/null +++ b/lab04/gen.c @@ -0,0 +1,13 @@ +#include <stdio.h> +#define AA 9999 + +int main(void){ + int a,b,scanf_ret; + setvbuf(stdout,NULL,_IOLBF,5); + while(1){ + scanf_ret = scanf("%d %d",&a,&b); + if(scanf_ret == EOF || a==AA)break; + printf("%d %d\n",a,b); + } + return scanf_ret; +} diff --git a/lab04/gen.o b/lab04/gen.o new file mode 100644 index 0000000000000000000000000000000000000000..5e2d6084b4bce404bf4a853dc2c726644d82420f GIT binary patch literal 2072 zcmb<-^>JfjWMqH=Mg}_u1P><4z%YXa!FB*M9T@l+co{zP%l!)V=zQwY{6-<gqnkxl zgMop;qto?=;Q^0sR*=G-AaWPT%zYrPN9XYuV7fQ-gGaCH8;{Oo9=*08ksTlcEZ6D! zrMdRY{}R=1*EhEO>I@7e(%qpSx?SI3QTuvZx9b;=Zr>j%9>zRi+e=u%hMYXCnxdeZ z!T=_@7#Q50ovjo!LX%4KN=g+h^-S~(bPY?vJi|I813d#1Jwr{1ILI9!?+P$5Fn}EI z?ib3y#K3R>B*qMqWME(rfzpgsK@5x)0*ul;>>Lvq85m?3AQ&V)2Sm8?3A8ae^Rh8b z=3(am31G*d@L^&2_#c}rGu9YkU|?o|xdv4iGXuz_sA3=<GuSsE7Aj_DU`G{z@|YR0 zJD8b)6RHB0VrF1N6<}Zhn=FLnesGvDFfi~iFff3^7hQue4slH!;)XcHL1`45`R+K> zGo+{H=_NDdCT8X_6qlsrmzFTZyZiV%Ir_x=ySW9shQx<BI{CQ9GZd$mlqHp>F~rAb z7Uw5hTE-VAC+4Lw6clCVm4HNxOA?c_<C8P8<I@r|a~R~H9%N!*VBlt8VEFSN0!*Re zpqS!C5(l{tBn46rN_#N%fgnK!25`*sA*nBhio?`{Xpm4Xh=8i+M^ZlxNgNbDF!L3l z;voGX4COK~=oMGymLw)I=oOa~LFfz^t0*-mQLiMmqJ%*&C9x!tK`*Jem_e^7AHqq_ z&&^HED`C*f%P&dQbN36?1qTh3pPpB$S5TB+kXlqy$)E=|DK#TLttc@!6>c>p43K|7 zc?vy6g3<-ZTv$2;u|XK57DU6aG&JmB>S5vu&@8tCDgcU8kX~3$k${S;F))BrJybbV zl!4(6oQ28&nSm^#!@vN}edOu~<qMFRC~?VvupgA>knIDhMdn*V-EV*_$iTqx63Pd; z56T2nF#Ryv3926~iA0FP6d;L#nCQYm(6R&F{Sr`xp!fypgJD?s!}wWH`_c7VK=oU| z6hdiq{h(9`%A4r%&jAu-U|@j7GbsK+r6Ei|OdMnly4@hF3P2JJ3=A`%G^iZpg2pvS r9;P2;CVJe1<T;>%5g-l{h8hPK5o7?>4{$D=p#XJ%30wriK-Uid;MCEU literal 0 HcmV?d00001 diff --git a/lab04/main.c b/lab04/main.c new file mode 100644 index 0000000..0304367 --- /dev/null +++ b/lab04/main.c @@ -0,0 +1,18 @@ +#include <stdio.h> +// +#include "func.h" + +extern int toBinaryString(char c[], int a); + +int Global_val = 2; + +int main() +{ + unsigned int a,b,c; + char ch[256]; + scanf("%d", &a); + printf("%d / %d\n",func1(a),DF(a)); + toBinaryString(ch, a); + printf("%s\n", ch); + return a; +} diff --git a/lab04/main.o b/lab04/main.o new file mode 100644 index 0000000000000000000000000000000000000000..84b6e0bbd8e30eb7a6543ab0caa5ddc6a921a519 GIT binary patch literal 2208 zcmb<-^>JfjWMqH=Mg}_u1P><4z@Wg2U^{@B4h(z@ybPcD<$i^FbUqFCXndo=$iR@| z(aoZ&!N9=a(dqia@PJ2e>z#l9|9f;E^XRn&Y1;uJUVw=1sUVqduzcrb{`EJY%;R9$ z&Rf{DKolSH=xu%Q@BjbKYaX2t)ldN#7h;k}x9^J-4`Uv%b4pmj#(Fd!0l6|d_Amnj z0}}%SgK7$cYKnrsf@%sE1B1J>vz3BIXi{ljNvVRRo{64;u3;&dXIN)spl4vBXQ&Ag zXJBDqU=UznU;qV+yI&~CtOFo1W{}qy7#KvLG-Fi|17n2%qcjgY#{@<O1{DSd1{tW_ zP7v+NC(y>^%**D{%*?cchn)i?h6jV<hK1qde{4#avBn$&12Y56Rj9g{!M;Eh1M!%_ zz5=mOF*5@@ssNP7%z)k1%nY1R6{r+50~@LU0|VFuK_qvA!V;uNn1O*o2+3dIFk@g~ zkbs6iNDVU9!yyhze4zM3RtsV~<52H~Lp&0PcpMIKhTO!=JiTNF_niEs#GLrD#2l~) zL%h3>zmua+yuX`Uuxm(sh@+E_Ydk}Id}eWevZZBwadKi_8bexXUa}!WK~ZL2Ng6{* zzEfsiVo_yqNl|8AIzvHeNijowd~r!)a&~-jMs|E!VrC8lgAT}3(6kLon}7a8fEiRA z6t27s3=A;w5F~LvB=LBtI4F;R%z>El|9>V_9ApkZlKLhjaZotJ%%6xPE{LRlHIldx zlDGm?9AqyDL%9qLdc~EwC5cH4dc`G05IO_KDoV{s)GJA?C}Ge`Ni0cZ&`T;VX3#6j zhj5bfb8}PkN*MI=@=H?n-2Fmz!C?mFr{|UG6%^$cq!yJ_GU$O#O3jE*D@x2wg<DMt z1LPl2o<&dbkTR5k0hXR&c7W8v*dSV(fdQOLVd_C*AbbIur4N8O3=9n13=H600?Ub@ z`~i|ugNj3ygM`5N5153Q4P}BUP`rW}Py&>mKxU%r2U`YJgG`~j-w<j)N?d|8Ko#<U z*hm;E3>UG4>NkLkKo~qwg&_AqL?9$o816hLsD6kng0z4sL<oUd=)yq^4B%1^-Tg5A zp!fxAgc6{zf-=EW7Sw)p{Si=$(Bl<dKPVM~;sjmY1dt%K90XYeihodP3)2sae~>lk zc7xQ<07)<~Fr0wWpm^Ydmct-<n0}C%7;(?Qz>okH%m*n(!cgPjBA`4ERSFjaF;+m` LUjpJFVRZcfvib}W literal 0 HcmV?d00001 diff --git a/lab04/mem_test.c b/lab04/mem_test.c new file mode 100644 index 0000000..593acd8 --- /dev/null +++ b/lab04/mem_test.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +int main() +{ +#ifdef __PCC_M32 + printf("CHAR: %d\n", sizeof(char)); + printf(“%d %d \n“, 100, 100); +#else + printf("CHAR: %ld\n", sizeof(char)); + printf(“%d %d \n“, 100, 100); +#endif +} diff --git a/lab04/tobin.c b/lab04/tobin.c new file mode 100644 index 0000000..f233153 --- /dev/null +++ b/lab04/tobin.c @@ -0,0 +1,10 @@ +int toBinaryString(char buf[], int a) +{ + int i=0; + for (i=0; i< 32; i++) + { + buf[i] = a & (1<< (31-i)) ? '1' : '0'; + } + buf[i] = 0; + return 1; +} diff --git a/lab04/tobin.o b/lab04/tobin.o new file mode 100644 index 0000000000000000000000000000000000000000..9a509cc44c264891ee0fc3b22be3ab3df2ae19f0 GIT binary patch literal 1472 zcmb<-^>JfjWMqH=Mg}_u1P><4z;J*G!FB*M9T<2RxEVh4%l!)V=zQwYS^J{1^vQA8 zKOjjc_1dJ{_0KK_28M>tgO^`*UQl*@(t4nTeWxJ<1H)_9odygH4Bf7OJd!VXbi2Or zV7$=5(d_z%vAOn-eBCh=iDL{5J3y|AJ<Q<l>};i=5t>w*S5m5Asb`{RpletP<{8!* z8R!|9=oxB4#6b>WU}0cj5MW?nU}a!naQ6#kU}9i601{&c%Q7&CKxxLRAO^+?0Y+&a zc8&>*3=A?15Dbzo01>Wy0&PsrylhPAJnS4G0qhv$N*0EX|FOw3V+~mb24;|}uxMar zfVmP?k{Rq9R51{bnSl*NVPIwkb__9)05dprKr962WME(rLUJeA?;z=t{G`l0y<~=x ze5cI3#G=aJlA_GKbOr^G90LQ`2S`bTfkCghGPfi#i9xTpqzFQ1z*r@z6(tOMDTyVC z40=h$#SD7M`MJ5Nc_j>bdHE%&dhULqy2T}l$=OhTdS0nsK~a7|YEelggI-Z;PNH6F zMtoXPVs0wbatbJE1_rQi(L)ZB#u*sk{)gHDieD%bOesS3qsP<+uq-Blu3w#jfdQ19 z$knd{wI7t1kZpt650Xa~huIIKO`-ac)qvP{Km-;H(+87sWnciOE|j=uU|@IvRRBvL zP%hZ7FgA#eh1!p<9~>zR3=9?^MMxMFR!Cfi2nGglDu%@uOwIvnpafI^l&(R!0Hz-% z4)PCFDO4qdvH(diFfe?8a2dE57#Kiipz8;Tp~oFaiw4wCm^~md5QZ8HVuG<C11SH4 SnJ7dARDU{(C?u^S3jqMj-F)l- literal 0 HcmV?d00001 diff --git a/lab05/func.c b/lab05/func.c new file mode 100644 index 0000000..827bd92 --- /dev/null +++ b/lab05/func.c @@ -0,0 +1,8 @@ +#include "func.h" + +int func1(int a){ + return a*10; +} +int func2(int a){ + return a*2; +} diff --git a/lab05/func.h b/lab05/func.h new file mode 100644 index 0000000..5f866f8 --- /dev/null +++ b/lab05/func.h @@ -0,0 +1,4 @@ +#pragma once +#define DF(a) ((a)*(a)) + +extern int func1(int x); diff --git a/lab05/gen.c b/lab05/gen.c new file mode 100644 index 0000000..392c697 --- /dev/null +++ b/lab05/gen.c @@ -0,0 +1,13 @@ +#include <stdio.h> +#define AA 9999 + +int main(void){ + int a,b,scanf_ret; + setvbuf(stdout,NULL,_IOLBF,5); + while(1){ + scanf_ret = scanf("%d %d",&a,&b); + if(scanf_ret == EOF || a==AA)break; + printf("%d %d\n",a,b); + } + return scanf_ret; +} diff --git a/lab05/main.c b/lab05/main.c new file mode 100644 index 0000000..a89f40c --- /dev/null +++ b/lab05/main.c @@ -0,0 +1,21 @@ +#include <stdio.h> +// +#include "func.h" +#include "func.h" + +extern int toBinaryString(char c[], int a); + +int Global_val = 2; + +int main() +{ + unsigned int a,b,c; + char ch[256]; + scanf("%d", &a); + printf("%d / %d\n",func1(a),DF(a)); +#if a > 100 + toBinaryString(ch, a); + printf("%s\n", ch); +#endif + return a; +} diff --git a/lab05/mem_test.c b/lab05/mem_test.c new file mode 100644 index 0000000..0558c7a --- /dev/null +++ b/lab05/mem_test.c @@ -0,0 +1,23 @@ +#include <stdio.h> +#define str(a) #a +#define astr(a) bbb ## a ## aaa + +str(Hwanyong); +astr(Hwanyong); + +int main() +{ + char buf[512] = "alskdj alkjd alksjd laksjd \ +laskjd laksjd alksjd la skjdla skdjals djal skdjlaksjd \ +laskjd laskjdl askjdla sdjals kdalskjd alskdj alksjd \ +laskdj alskdjal d asldkjl"; +#ifdef __PCC_M32 + printf("CHAR: %d\n", sizeof(char)); + printf(“%d %d \n“, 100, 100); +#else +#error THIS IS ERROR + printf("CHAR: %ld\n", sizeof(char)); + printf("%d %d \n", 100, 100); + printf("%d : %s\n", __LINE__, __FILE__); +#endif +} diff --git a/lab05/test.c b/lab05/test.c new file mode 100644 index 0000000..b817fe7 --- /dev/null +++ b/lab05/test.c @@ -0,0 +1,21 @@ +#if 0 +100 \ +200 +/* Comment */ +300 \ +400 +A A A +#define A B +#define B 99999999 +A +B +#endif +#define HE HI +#define LLO _THERE +#define HELLO "HI THERE" +#define CAT(a,b) a##b +#define XCAT(a,b) CAT(a,b) +#define CALL(fn) fn(HE,LLO) +CAT(HE,LLO); +XCAT(HE,LLO); +CALL(CAT); diff --git a/lab05/tobin.c b/lab05/tobin.c new file mode 100644 index 0000000..f233153 --- /dev/null +++ b/lab05/tobin.c @@ -0,0 +1,10 @@ +int toBinaryString(char buf[], int a) +{ + int i=0; + for (i=0; i< 32; i++) + { + buf[i] = a & (1<< (31-i)) ? '1' : '0'; + } + buf[i] = 0; + return 1; +} diff --git a/lab06/const_test.c b/lab06/const_test.c new file mode 100644 index 0000000..a2d04b0 --- /dev/null +++ b/lab06/const_test.c @@ -0,0 +1,16 @@ +#include <stdio.h> + +int main() +{ + int a[2] = {10,10}; + int const * b = a; + + a[0] = 200; + *b = 300; + b = &a[1]; + + printf("%d %d\n",a[0],a[1]); +} + +// 10 10 +// 0x7fffb2841630 10 0x7fffb2841628 8 diff --git a/lab07/funcp.c b/lab07/funcp.c new file mode 100644 index 0000000..a329069 --- /dev/null +++ b/lab07/funcp.c @@ -0,0 +1,36 @@ +#include <stdio.h> + +int add(int a, int b) +{ + return a+b; +} + +int mul (int a, int b) +{ + return a*b; +} +int sq (float a) +{ + return (int) (a*a); +} + +int main() +{ + char op; + int a,b; + int fnum=0; + + int (*ff[3])() = {add, mul, sq}; + + + scanf("%c %d %d", &op, &a, &b); + if (op =='+') + fnum = 0; + else if (op == '*') + fnum = 1; + else + fnum = 2; + printf("%d\n", ff[fnum](a,b)); + return 0; +} + diff --git a/lab07/po2.c b/lab07/po2.c new file mode 100644 index 0000000..c6f770e --- /dev/null +++ b/lab07/po2.c @@ -0,0 +1,19 @@ +#include <stdio.h> +#include <stdlib.h> +int func(int **p) +{ + printf("Func: %p %p %p\n",*p, p, &p); + *p = (int *) malloc(8); + (*p)[0] = 500; + printf("Func:%d %p %p %p\n",**p, *p, p, &p); + return 0; +} + +int main() +{ + int *ppp=NULL; + printf("Main:%p %p\n", ppp, &ppp); + func (&ppp); + printf("Main:%d %p %p\n",*ppp, ppp, &ppp); + return 0; +} diff --git a/lab07/pointer.c b/lab07/pointer.c new file mode 100644 index 0000000..18216ac --- /dev/null +++ b/lab07/pointer.c @@ -0,0 +1,22 @@ +#include <stdio.h> +int func(int a) +{ + static int counter = 0; + int b = 999; + int c = 1000; + counter++; + fprintf(stderr,"func(): %d %p %p %p %p\n", counter, &counter, &a, &b,&c); + if (counter < 10) + func(counter); + return a * 10; +} + +int main() +{ + int z = 200; + int a[2] = {10,10}; + int *a0; + a0 = &a[0]; + printf("%p %p %p\n", a0, &a, &a0); +} + -- GitLab