note.dvi
|
|
- 怨 祁
- 4 years ago
- Views:
Transcription
1 314 #include <stdio.h> int x ; x = 0 ; if (x == 0) printf("if part\n") ; else printf("else part\n") ; if (x) printf("if part\n") ; else printf("else part\n") ; if (!x) printf("if part\n") ; else printf("else part\n") ; x = 1 ; if (x&1) printf("if part\n") ; else printf("else part\n") ; if (x&1==0) printf("if part\n") ; else printf("else part\n") ; 6.10,., printf, getchar, random,., C.,,,. C, [2,B] C (parameter), (return value).,,,, C,. 58,. < > < > ( < > ) 58. C5.tex,v :21:11+09 naito Exp
2 315 (parameter),. Section , (argument). Example int, int. int sum(int n, int m) return n + m ;, return. return,. Example , int. int max(int n, int m) if (n < m) return m ; return n ; int max(int n, int m) return (n < m)? m : n ; int. (cf. [3, X , p. 1922], [2, A10]),, void..,. Example ,. void only_print(void) printf("hello\n") ; return ; only_print(), only_print(void)., printf,.. 59 Example ,,,. ( Section 6.11). 59. C5.tex,v :21:11+09 naito Exp
3 316 #include <stdio.h> int a,b,c ; int sum(int b, int c) return b + c ; a = 0 ; b = 1 ; c = sum(a,b) ; return c ; main.,., Section 6.12, C,, ,.,,.,. C,. C pow.,. 60 double pow(double x, double y), x y.,, double. int n=2,m=3 ; pow(n,m) ; pow(3,5) ;, int,,.,, integer promotion., int double.,. 60 man 3 pow. C5.tex,v :21:11+09 naito Exp
4 317 Example , int. double x = 2.5, y = 0.3 ; int max(int n, int m) return (n < m)? m : n ; double z ; z = max(x,y) ; printf("%f %f\n", z, max(x,y)) ;. max int, double, double int. 61, max 2, 0, int 2., z 2.0., printf,, ,, (.) Remark ,, #define max(a,b) (((A) < (B))? (B) : (A)) printf("%f\n", max(1.0, 2.0)) ;.,,. Remark #define max(a,b) (A < B)? B : A.,, max(5 3, 2&1)., 2&1, 5 3,, 0, 7, 7.,, 0., (5 3 < 2&1)? 2&1 : ,,.,,. C5.tex,v :21:11+09 naito Exp
5 318, 5 3 < 2&1 5 (3<2)&1, 5 0&1 = 5 0 = 0.,,. Remark int v ; func(v++,v++) ;,. Remark ,,,., f() + g() * h(), g h. Example , a/b*b a*b/b a, b,,, Section , int.,.,., double test fn,. int n ; n = test_fn(n) ; double test_fn(double a)...,,. main test fn,. C test fn,., Section 6.12,. 62,,.,. C5.tex,v :21:11+09 naito Exp
6 319,. ANSI [3, X , p. 1922] K&R [2, A10], int.,, int.,. main test fn, test fn int. test fn int,., test fn, double,.,, (prototype).,,. extern double test_fn(double) ;, main. extern double test_fn(double, double) ;., extern double test_fn(double) ; int n ; n = test_fn(n) ; double test_fn(double a).... extern (storage class specifier), section Remark extern double test_fn(double) ; int n ; 63 extern. C5.tex,v :21:11+09 naito Exp
7 320 n = test_fn(n) ; double test_fn(double a)...., test fn, main. C, #include <stdio.h>. stdio.h, printf.,, #include. Remark , double. math.h, math.h. #include <stdio.h> #include <stdio.h> #include <math.h> printf("%f\n", pow(2.0,1.5)) ; printf("%f\n", pow(2.0,1.5)) ; math.h., pow., , math.h., pow., ,., pow, pow int,, int ,,. static 64, static. static. 65,. C5.tex,v :21:11+09 naito Exp
8 321,,.,,.,,. Example , sum, main. #include <stdio.h> extern int sum(int, int) ; int a,b,c ; a = 0 ; b = 1 ; c = sum(a,b) ; return c ; int sum(int b, int c) int a ; a = b + c ; return a ;, main a,b,c, sum a,b,c.,.,,, 66. Example , sum,. 66,, Section C5.tex,v :21:11+09 naito Exp
9 322 #include <stdio.h> int a,b,c ; extern int sum(int, int) ; a = 0 ; b = 1 ; c = sum(a,b) ; return c ; int sum(int b, int c) int a ; a = b + c ; return a ;, sum, a,b,c,,,., Section Exercise #include <stdio.h> int a = 1, b = 2, c = 3 ; extern int foo(void) ; int a = 0, b = 1 ; printf("a = %d, b = %d, c = %d\n", a,b,c) ; foo() ; foo() ; printf("a = %d, b = %d, c = %d\n", a,b,c) ; int foo(void) int a = 2, b = 0 ; C5.tex,v :21:11+09 naito Exp
10 323 printf("a = %d, b = %d, c = %d\n", a,b,c) ; a += 1 ; printf("a = %d, b = %d, c = %d\n", a,b,c) ; return ; main main ANSI,, 67. Section ,. printf,,, pow,, ld: Undefined symbol _pow collect2: ld returned 2 exit status error., pow,.,, libxxxx.a., libxxxx.a,. % gcc a.c -lxxxx -o a -l, libxxxx.a XXXX. pow, libm.a, % gcc a.c -lm -o a,. Section ,.,,..,.,,., ,,. 68 Section C5.tex,v :21:11+09 naito Exp
11 324,,. call by value. Pascal var (call by address ) C, (recursive function call, (recursion).,., 69,.,,.,. Example , a n+1 = a n +2,a 0 =0 a n. int recursive_function(unsigned int n) if (n == 0) return recursive_function(n-1) + 2 ;,,.,.. (cf. [7, Section 3.2]) Section printf,.,....,., stdarg.h va_arg 70.,,.,. Example %s printf. 69,. 70, [2,B7]. C5.tex,v :21:11+09 naito Exp
12 325 #include <stdarg.h> int test_va(char *fmt,...) va_list ap ; char *p,*sval ; va_start(ap,fmt) ; for(p=fmt;*p;p++) if ( *p!= % ) putchar(*p) ; continue ; switch (*++p) case s : for(sval = va_arg(ap,char *);*sval;sval++) putchar(*sval) ; va_end(ap) ;, test_va("test %s",str),., va_start, va_list. fmt %,, continue,., %, s, va_arg,., va_end,., char *,.,,,,., NULL (NULL terminate). Remark [1], char int. (cf. [1, 7.1].), ANSI [2],,. (cf. [1, A7.3.2, A10.1].),,, float double., int foo(char a) char, int foo(a) char a ; char int., char short,, int. C5.tex,v :21:11+09 naito Exp
13 , C atoi. atoi, char,,,, 0 9,, int, int 0.,, 0,.,., C errno.h, strerror (strerror string.h). errno.h int errno,, errno 0,. Example , atoi,. #include <stdio.h> #include <stdlib.h> #include <errno.h> int n ; n = atoi("x") ; printf("errno = %d\n", errno) ; if (errno) printf("error: %s\n", strerror(errno)) ; else printf("integer = %d\n",n) ;, atoi C,, errno 0,, else.,, errno 0. errno, UNIX /usr/include/sys/errno.h, strerror., Example , Solaris 2.6, errno, EINVAL ( 22), Invalied argiment Exercise int mul(int n, int m) mul n m., mul n*m. C5.tex,v :21:11+09 naito Exp
14 327 Exercise int div(int n, int m) div n m., div n/m., m, errno EINVAL. Exercise int mod(int n, int m) mod n m., div n%m., m, errno EINVAL. Exercise int pow_int(int n, int m) pow int n m.,, errno EINVAL. Exercise double pow_d(double n, int m) pow d n m.,, errno EINVAL. Exercise int is_upper(int c) c 0, 0., ASCII. Exercise ,. Exercise unsigned int x p n, invert bit(x,p,n)., 0. Exercise x n rot right(x,n). Exercise Exercise ,. Exercise , n!.,. Exercise , n n.,. Exercise ,, F 0 =0,F 1 =1,F n+2 = F n+1 + F n F n, C5.tex,v :21:11+09 naito Exp
15 328 int fib(unsigned int n) if (n == 0) if (n == 1) return 1 ; return fib(n-1) + fib(n-2) ;.,,,. Exercise printf., printf. printf, b,., C,,,.,, C,, ,, (identifier) ,,,.,,,,,, (name space)..,,. C6.tex,v :11:45+09 naito Exp
16 329,..,, 71. Section ,,,,,,, ,.,. (declaration),. (definition) 72.,., (type).,.,, 73.,.,,,... extern 74. extern.,,,. Example ,,,,,,. 72 ANSI,,, static, (tentative definition).,. (cf.[3,x ,p.1924]) 73, traditional.,,. 74,,. extern..., extern,. C6.tex,v :11:45+09 naito Exp
17 330 extern int sum(int, int) ; extern int x ; int a ; <==== <====, <==== <====... int sum(int a, int b) int c ; <==== <==== Example extern int x = 1 ;, extern., extern., extern. Example ,., Section /* file1.c */ int x = 1 ; /* file2.c */ extern int x = 1 ; x C, 75.C,, (scope, ), (visible) ,. C6.tex,v :11:45+09 naito Exp
18 331 3., 4..,.. 1..,..,. 2.,.., , ,,. Example #include <stdio.h> int i ; /* */ extern int sum(int a, int b) ; /* */ int main(int argc,char **argv) /* */ int j ; /* */ int k ; /* */ k = 0 ; int l ; /* */., Example l,,. 76,.., (debug).,,. 77,, ANSI, goto,.,.. C6.tex,v :11:45+09 naito Exp
19 332 Example Example l. #include <stdio.h> int i, l ; int main(int argc,char **argv) int j ; #include <stdio.h> int i ; extern int l ; int main(int argc,char **argv) int j ; j = 0 ; int k ; k = 0 ; j = 0 ; int k ; k = 0 ; int l ;, l, extern.,, 78. Example int main(int argc,char **argv) int j ; j = 0 ; int k ; /* */ k = 0 ; int k, , int i ; int i ; 78, Example int l,. C6.tex,v :11:45+09 naito Exp
20 333 int i ;,,,,... int i ; <= i0 /* i, i0 */ int i ; <= i1 /* i, i1 */ int i ; <= i2 /* i, i2 */ /* i, i1 */ /* i, i0 */ ,. int main(int argc,char **argv) int a ; extern int foo(int) ; foo(a) ; double foo(int a)..., foo, main , (storage duration),,. C (static) (auto) C6.tex,v :11:45+09 naito Exp
21 334.,,.,,.,,.,.,.,,,,,,., static.,,,. Example int j ; static int n ; int add(int x) int i ; static int l ;... int k ;... sub(k) ;... int sub(int y) int m ; static int s ;... j, l, n, s, x, i, k, y, m., x, i, k, add, y, m, sub., add sub, add sub, add ,. 79, ,. C6.tex,v :11:45+09 naito Exp
22 335 static,,,. (cf. Example ) (linkage, ),, 80. (external linkage), (internal linkage), (no linkage).,,,.,.,,,,,,. extern static,.. 1. static,. 2. extern,.,. 3., extern. 4.,. 5.,, extern,.,, ,,.,,., 80 C,,. C6.tex,v :11:45+09 naito Exp
23 336, extern static,.,,., extern,,,., static,,.,. Example foo l. #include <stdio.h> int i ; int l = 2 ; static int k ; int k ; extern void foo(void) ; int main(int argc,char **argv) int i ; extern int l ; printf("l = %d\n", l) ; foo() ; printf("l = %d\n", l) ; void foo(void) l = 0 ; return ; foo, extern,,., foo main,. foo main,, foo Example. l, main extern,, l.,,, C6.tex,v :11:45+09 naito Exp
24 337 l = 2 l = 0.,, i i,. k static, int k,. extern int k,, k static. Example #include <stdio.h> extern void bar(void) ; int main(int argc,char **argv) extern void foo(void) ; foo() ; int bar(void) foo() ; void foo(void) return ;, foo, bar, foo.,,,, extern ,,., 81 81,. C6.tex,v :11:45+09 naito Exp
25 ,., extern,.. file1.c, file2.c. foo() ; void foo(void) return ;, file1.c foo, file2.c foo YES., file2.c foo,., file1.c foo,., file1.c foo,., extern void foo(void) ; foo() ; void foo(void) return ;, file1.c foo.,, file2.c foo,,., file1.c extern.,,,, extern., foo() ; static void foo(void) return ; C6.tex,v :11:45+09 naito Exp
26 339, file2.c foo static., file2.c foo, file1.c foo, file2.c foo static 2. static, static, extern static. static,. static.,, ,,,.., extern,.,.. file1.c, file2.c. int i ; i = 0 ; foo() ; int i ; void foo(void) i = 1 ; return ;, file1.c i, file2.c i., file1.c, file2.c i,,.,, extern., int i ; i = 0 ; foo() ; extern int i ; void foo(void) i = 1 ; return ; 82 file1.c foo,., Section C6.tex,v :11:45+09 naito Exp
27 340.,. int i = 0 ; i = 0 ; foo() ; extern int i = 1 ; void foo(void) i = 1 ; return ;,., static,., int i = 0 ; i = 0 ; foo() ; static int i = 1 ; void foo(void) i = 1 ; return ;, file2.c i, file1.c i. file1.c i. Remark i. int i ; int i ; int main(int argc,char **argv) int i ; int i ; int main(int argc,char **argv) int i ; int i ;. int i,.,. int i,. C6.tex,v :11:45+09 naito Exp
28 ,.,,,,., static,., static., static,.,,. Example , i i+=1. int function() static int i = 0 ; i += 1 ;..., i , 83.,,., [3, X 3010, 6.5.7, p. 1910].,,,.,. (cf. [3, X 3010, 6.5.7, p. 1910, Footnote 74].),,, data,.,. Example ,. int a = 1, b = a ;..., b = a.,,. Example ,. 83,. C6.tex,v :11:45+09 naito Exp
29 342 int foo(int a) int b = a ;...,. Example int foo(void) int a = 0, b = a ;... int foo(void) int b = a, a = 0 ;....,., a, b, a b a,..,, 84,,, 85,. Example ,,. int a ; foo(void) int a = a ;..., foo a a, a.,, a a.,. int a = 1 ; int foo(void) int b = a, a = 0 ;... 84,,,. 85 [3, X 3010, 6.5.4, p. 1904],.,,,.,,,,. C6.tex,v :11:45+09 naito Exp
30 343, int b = a, a, int b = a a a. Example ,. int foo(int n) static int a = n ;...., [3, X 3010, 6.5.7, p. 1910],,,., extern, Exercise #include <stdio.h> int i=0 ; int main() auto int i=1 ; printf("i=%d\n",i) ; int i=2 ; printf("i=%d\n",i) ; i += 1 ; printf("i=%d\n",i) ; printf("i=%d\n",i) ; printf("i=%d\n",i) ; Exercise C6.tex,v :11:45+09 naito Exp
31 344 #include <stdio.h> int i=0 ; int main() int i=1 ; func_1(i) ; printf("1: i=%d\n",i) ; func_1(i) ; printf("1: i=%d\n",i) ; int func_1(int n) int i=0 ; i += 1 ; n += 1; printf("2: i=%d\n",i) ;, sub_function i static int i = C,. 1. (preprosessor (object code), (compile). (compiler).,,,.,. 3.,, (link). (linker). 86, gcc -E file.c.,,. C6-1.tex,v :07:38+09 naito Exp
32 345 file1.c compile file1.o file2.c compile file2.o link library exec code % gcc file.c -o target,.,,,,, file1.c, % gcc -c file1.c. file1.o.,., % gcc -S file1.c, file1.s.,, ,, file1.c, file2.c. C6-1.tex,v :07:38+09 naito Exp
33 346 #include <stdio.h> int k = 0 ; extern int i ; extern int add(int) ; int main(int argc,char **argv) int j ; static int l = 0 ; extern int k ; extern int i ; static int l = 0 ; int add(int j) i += 1 ; l += 1 ; k += 1 ; return j + 1 ; i = j = 0 ; add(j) ; printf("%d\n", i) ; printf("%d\n", j) ; static void foo(void) k = 0 ; l = 0 ; return ; gcc -S file1.c, gcc -S file2.c 87. ############## file1.c.file "file1.c" gcc2_compiled.:.global k.section ".data".align 4.type k,#object.size k,4 k:.uaword 0.align 4.type l.3,#object.size l.3,4 l.3:.uaword 0.section ".rodata".align 8.LLC0:.asciz "%d\n".section ".text".align 4.global main.type main,#function 87, SunOS 5.6 gcc version ,,,, OS,. C6-1.tex,v :07:38+09 naito Exp
34 347 main:.ll2:.llfe1:.proc 04!#PROLOGUE# 0 save %sp, -120, %sp!#prologue# 1 st %i0, [%fp+68] st %i1, [%fp+72] sethi %hi(i), %o1 or %o1, %lo(i), %o0 st %g0, [%fp-20] st %g0, [%o0] ld [%fp-20], %o0 call add, 0 nop sethi %hi(i), %o0 or %o0, %lo(i), %o1 sethi %hi(.llc0), %o2 or %o2, %lo(.llc0), %o0 ld [%o1], %o1 call printf, 0 nop sethi %hi(.llc0), %o1 or %o1, %lo(.llc0), %o0 ld [%fp-20], %o1 call printf, 0 nop mov 0, %i0 b.ll2 nop ret restore.size main,.llfe1-main.ident "GCC: (GNU) (release)" ############## file2.c.file "file2.c" gcc2_compiled.:.section ".data".align 4.type l,#object.size l,4 l: C6-1.tex,v :07:38+09 naito Exp
35 348.uaword 0.section ".text".align 4.global add.type add,#function.proc 04 add:!#prologue# 0 save %sp, -112, %sp!#prologue# 1 st %i0, [%fp+68] sethi %hi(i), %o1 or %o1, %lo(i), %o0 sethi %hi(i), %o2 or %o2, %lo(i), %o1 ld [%o1], %o2 add %o2, 1, %o1 st %o1, [%o0] sethi %hi(l), %o1 or %o1, %lo(l), %o0 sethi %hi(l), %o2 or %o2, %lo(l), %o1 ld [%o1], %o2 add %o2, 1, %o1 st %o1, [%o0] sethi %hi(k), %o1 or %o1, %lo(k), %o0 sethi %hi(k), %o2 or %o2, %lo(k), %o1 ld [%o1], %o2 add %o2, 1, %o1 st %o1, [%o0] ld [%fp+68], %o1 add %o1, 1, %o0 mov %o0, %i0 b.ll2 nop.ll2: ret restore.llfe1:.size add,.llfe1-add.align 4.type foo,#function C6-1.tex,v :07:38+09 naito Exp
36 349 foo:.ll3:.llfe2:.proc 020!#PROLOGUE# 0 save %sp, -112, %sp!#prologue# 1 sethi %hi(k), %o1 or %o1, %lo(k), %o0 st %g0, [%o0] sethi %hi(l), %o1 or %o1, %lo(l), %o0 st %g0, [%o0] b.ll3 nop ret restore.size foo,.llfe2-foo.ident "GCC: (GNU) (release)", file1.c file2.c,,., gcc -c file1.c, gcc -c file2.c,,, UNIX nm (symbol table),,,. file1.o: [Index] Value Size Type Bind Other Shname Name [9] 0 0 SECT LOCL 0.comment [2] 0 0 SECT LOCL 0.text [3] 0 0 SECT LOCL 0.data [4] 0 0 SECT LOCL 0.bss [7] 0 0 SECT LOCL 0.rodata [8] 0 0 NOTY LOCL 0 ABS *ABS* [13] 0 0 NOTY GLOB 0 UNDEF add [1] 0 0 FILE LOCL 0 ABS file1.c [5] 0 0 NOTY LOCL 0.text gcc2_compiled. [12] 0 0 NOTY GLOB 0 UNDEF i [10] 0 4 OBJT GLOB 0.data k [6] 4 4 OBJT LOCL 0.data l.3 [11] FUNC GLOB 0.text main [14] 0 0 NOTY GLOB 0 UNDEF printf file2.o: [Index] Value Size Type Bind Other Shname Name C6-1.tex,v :07:38+09 naito Exp
37 350 [2] 0 0 SECT LOCL 0.text [3] 0 0 SECT LOCL 0.data [4] 0 0 SECT LOCL 0.bss [9] 0 0 SECT LOCL 0.comment [8] 0 0 NOTY LOCL 0 ABS *ABS* [10] FUNC GLOB 0.text add [1] 0 0 FILE LOCL 0 ABS file2.c [7] FUNC LOCL 0.text foo [5] 0 0 NOTY LOCL 0.text gcc2_compiled. [11] 0 0 NOTY GLOB 0 UNDEF i [12] 0 0 NOTY GLOB 0 UNDEF k [6] 0 4 OBJT LOCL 0.data l nm Name,, Bind., Shndx UNDEF,. file1.c, printf, add,,, call printf, call add,., file1.c main, file2.c add,,, Type FUNC, Bind GLOB 88., file1.o, add, printf UNDEF,. file2.c foo static,, file2.o, Type FUNC, Bind LOCL. file1.c, file2.c,. file1.c main j.,, :, %hi(i), %lo(i).,. file1.c main l., LOCL OBJT, Size 89. file1.c k., GLOB OBJT,. file1.c file2.c i.., GLOB NOTY (No Type), UNDEF 90. file2.c l. 88, text global. 89 file1.s, data, 0. 90,. C6-1.tex,v :07:38+09 naito Exp
38 351, LOCL OBJT, 91., Size,, Value 92.,,,., ,,,. (link)., Section , file1.o file2.o, printf. printf C, (library),,.,, Section file1.o file2.o,, C, gcc file1.o file2.o -o target., -o target target,.,,. UNIX, /usr/lib/libc.a., C, 93,. UNIX /usr/lib/libm.a, 94, gcc file1.o file2.o -o target -lm 91,., C static,,,., static. 92, text. 93, sin, log. 94,,.,,,,,.,., Darwin(MacOSX) Public Beta Version,. Darwin NeXTSTEP,,, Darwin. C6-1.tex,v :07:38+09 naito Exp
39 352, -lm 95., -lm., file1.o sin, gcc -lm file1.o file2.o -o target,., Undefined first referenced symbol in file sin file1.o ld: fatal: Symbol referencing errors.., libm.a, file1.o sin.,.,, C,., Sun Microsystems Solaris 2.6 (SunOS 5.6 Generic sparc SUNW), 1.6 MB, Sun Microsystems SunOS (SunOS JL 1), 670 KB, FreeBSD 4.2-Release (4.2-RELEASE FreeBSD), 1.1 MB.,., UNIX Windows, MacOS, (Dynamic Linking Library),.,,,,,.,,,,,, (static link) (archive), ar, ar -q libx.a file2.o file3.o, file2.o, file3.o libx.a, -lx 96.,, 95 -l XXXX, libxxxx.a,., /usr/lib,, -L/usr/local/lib -L. 96.a archive. C6-1.tex,v :07:38+09 naito Exp
40 353 gcc -o libx.so -G file2.o file1.o (interpositioning),. C, (reserve), 99., C islower #include <stdio.h> extern int islower(int) ; int c= a ; if (islower(c)) printf("%c is lower character\n",c) ; else printf("%c is not lower character\n",c) ; int islower(int c) if ((c >= A )&&(c <= Z )) return 1 ;, a is not lower character.,,, islower 101, islower, islower.,.,. 97.so shared object.,, ldd. ldd /usr/bin/cp. 98, Solaris 2.x,, -R, LD LIBRARY PATH. SunOS 4.x, ld.so,., ld.so., ld.so. 99 [6], islower ctype.h. 101 FreeBSD 4.2 RELEASE (/usr/src/lib ), libc/net/inet network.c. C6-1.tex,v :07:38+09 naito Exp
41 , C,.,, (Section ) UNIX, mmap,,,.,.,. int i, j = 0 ; static int k, l = 1 ; int n, m = 1 ; static int s, t = 0 ; n = l + j ;,, 102, a.out: [Index] Value Size Type Bind Other Shname Name [61] FUNC GLOB 0.text _start [73] OBJT WEAK 0.bss environ [62] OBJT GLOB 0.bss i [63] OBJT GLOB 0.data j [50] OBJT LOCL 0.bss k [47] OBJT LOCL 0.data l [79] FUNC GLOB 0.text main [33] OBJT LOCL 0.bss object.11 [48] OBJT LOCL 0.bss s.3 [49] OBJT LOCL 0.data t.4., i, j, k, l, s, t, n, m,., UNIX (segment). UNIX 103,, UNIX 102, nm -s a.out. 103 MS-DOS. MS-DOS, CPU, CPU 20, C6-1.tex,v :07:38+09 naito Exp
42 355 text.. data.,. bss.,. stack.,..,. n (main ) m (main ) stack bss data s k i t l j text, data,,. bss 0. stack,,., alloca,. (malloc ), stack. text size, a.out, C6-1.tex,v :07:38+09 naito Exp
43 356 % size a.out = 2716, text 2288, data 360, bss , segmentation fault,. stack,, stack,. stack limit cputime unlimited filesize unlimited datasize kbytes stacksize 8192 kbytes coredumpsize 0 kbytes vmemoryuse unlimited descriptors Section ,,., ,. extern int add(int, int) ; int n, m ; n = 1 ; m = 2 ; n = add(n,m) ; int add(int a, int b) 104,. C6-1.tex,v :07:38+09 naito Exp
44 357 return a + b ;, add,, add,. n, m,. main n, 1 main m, 2 main n, 1 main m, 2 main n, 1 main m, 2 add 3 add a, 1 add a, 1 add a, 2 add a, 2 main main n, 1 main m, 2 3 main n, 3 main m, 2,,,., extern int add(int) ; int n ; n = 1 ; add(n) ; int add(int a) ; return ++a ;, main n, 1 main n, 1 main n, 1 add add a, 1 add 2 a, 2 main main n, 1 2 main n, 1 C6-1.tex,v :07:38+09 naito Exp
45 358, n.,, bss,,. extern int add(int) ; int k = 0 ; int n = 1 ; n = add(n) ; int add(int a) ; int b = 1 ; b += 1 ; k += 1 ; return ++a ;, return main n, 1 main n, 1 main n, 1 add add a, 1 add add a, 1 add b, 1 add b, 2 k, 0 k, 0 k, 1 main main n, 1 2 add a, 2 main n, 1 2 main n, 2 add b, 2 k, 1 k, 1 k, 1, k. k. Remark ,.,,,,,.,.,, , Pascal, Fortran,,,,. C6-1.tex,v :07:38+09 naito Exp
46 ,., a n+2 = a n+1 + a n, a 0 =0,a 1 =1.,, int fib(int n) if (n == 0) if (n == 1) return 1 ; return fib(n-1) + fib(n-2) ;. fib(4), fib(4) = fib(3) + fib(2) =(fib(2) + fib(1)) + (fib(1) + fib(0)) =((fib(1) + fib(0)) + fib(1)) + (fib(1) + fib(0))., fib(4) fib(2), fib(1), fib(0),., fib(n) fib, fib(n)., Example , a n+1 = a n +2,a 0 =0 a n. int func(unsigned int n) if (n == 0) return func(n-1) + 2 ; func(3) func(3) = func(2) + 2 =(func(1) + 2) + 2 =((func(0) + 2) + 2), func(2), func(1), func(0). func func(a) func, func (linear recursive) Example a n+1 = a n +2, a 0 =0 a n. int func(unsigned int n) C6-1.tex,v :07:38+09 naito Exp
47 360 if (n == 0) return func(n-1) + 2 ; func(3) func(3) = func(2) + 2 =(func(1) + 2) + 2 = (((func(0)+2)+2)+2), func(2)+1 func(2)., func(1)+2 func(1), func(0), 0, func(1) + 2., func(3), func(2), func(1), func(0)., func(3) = func(2) + 2 =(func(1) + 2) + 2 = (((func(0)+2)+2)+2) = (((0 + 2)2) + 2) = ((2 + 2) + 2) =(4+2) =6.. func(2) func(1) (func(2) ) (func(2) ) 2 (func(2) ) (func(2) ) 2 (func(1) ) (func(1) ) 1 func(0) func(0) func(1) (func(2) ) (func(2) ) 2 (func(1) ) (func(1) ) 1 (func(0) ) (func(0) ) 0 (func(2) ) (func(2) ) 2 (func(1) ) (func(1) ) 1 (func(0) ) 0 (func(2) ) (func(2) ) 2 (func(1) ) 2 func(2) (func(2) ) 4 func(), return func(n-1) + 2, 2.,. C6-1.tex,v :07:38+09 naito Exp
48 ,, (tail recursive). Example int g(int n, int a) return n?g(n-1,n*a):a ;, a if n =0,, g(n, a) =a n!. g(n, a) = g(3, 1), g(n 1,na). g(3, 1) = g(2, 3) = g(1, 6) = g(0, 6) = 6.,,.,,. int g(int n, int a) while(1) if (n == 0) return a ; else a *= n ; n -= 1 ;.,.,., return f(n-1)+2 ;,,.,,,,.,., g(2, 3). C6-1.tex,v :07:38+09 naito Exp
49 362 g(2.3) g(1,6) (g(2,3) ) (g(1,6) ) (g(2,3) ) 2, 3 (g(1,6) ) 1, 6 g(0,6) g(0,6) g(1,6) (g(0,6) ) (g(1,6) ) (g(2,3) ) (g(0,6) ) 0, 6 g(2,3) (g(2,3) ) ,,,. func,,. #include <stdio.h> extern int func(unsigned int) ; func(10) ; int func(unsigned int n) char c ; printf("n = %3d, c = %p\n",n,&c) ; if (n == 0) return func(n-1) + 2 ;, c = %p, &c,, c.,., n = n = n = n = n = n = 10, c = effff9a7 9, c = effff92f 8, c = effff8b7 7, c = effff83f 6, c = effff7c7 5, c = effff74f C6-1.tex,v :07:38+09 naito Exp
50 363 n = n = n = n = n = 4, c = effff6d7 3, c = effff65f 2, c = effff5e7 1, c = effff56f 0, c = effff4f7,.,, limit stacksize 1.,., func(100).,, Segmentation fault.,,., fib. fib(n) fib(n). 1 5 ( ) n 1.6 n., 10 9, N 1.6 N =10 9 /100 = 10 7, N =7log ,.,,. N = Exercise ,. #include <stdio.h> extern int sub_function(void) ; int i=0 ; int j=0 ; int main() sub_function() ; printf("i=%d, j=%d\n",i,j) ; extern int i ; static int j ; int sub_function() i += 1 ; j += 1 ; Exercise ,. C6-1.tex,v :07:38+09 naito Exp
51 364 #include <stdio.h> extern int sub_function(void) ; int i=0 ; int j=0 ; int main() sub_function() ; printf("i=%d, j=%d\n",i,j) ; extern int i ; extern int j ; int sub_function() i += 1 ; j += 1 ; (array),, ,., int 10 digit. int digit[10] ;, digit, [ ],., 0.,, unsigned long.,,. digit[0],..., digit[9] [ ]., 0, 106. digit[0] digit[1] digit[2] digit[3] digit[4] digit[5] digit[6] digit[7] digit[8] digit[9],., extern int digit[] ;,,,.,,,. 106,. C7.tex,v :13:15+09 naito Exp
C/C++ - 函数
C/C++ Table of contents 1. 2. 3. & 4. 5. 1 2 3 # include # define SIZE 50 int main ( void ) { float list [ SIZE ]; readlist (list, SIZE ); sort (list, SIZE ); average (list, SIZE ); bargragh
More information新版 明解C言語入門編
328, 4, 110, 189, 103, 11... 318. 274 6 ; 10 ; 5? 48 & & 228! 61!= 42 ^= 66 _ 82 /= 66 /* 3 / 19 ~ 164 OR 53 OR 164 = 66 ( ) 115 ( ) 31 ^ OR 164 [] 89, 241 [] 324 + + 4, 19, 241 + + 22 ++ 67 ++ 73 += 66
More informationC/C++ - 文件IO
C/C++ IO Table of contents 1. 2. 3. 4. 1 C ASCII ASCII ASCII 2 10000 00100111 00010000 31H, 30H, 30H, 30H, 30H 1, 0, 0, 0, 0 ASCII 3 4 5 UNIX ANSI C 5 FILE FILE 6 stdio.h typedef struct { int level ;
More informationCC213
: (Ken-Yi Lee), E-mail: feis.tw@gmail.com 49 [P.51] C/C++ [P.52] [P.53] [P.55] (int) [P.57] (float/double) [P.58] printf scanf [P.59] [P.61] ( / ) [P.62] (char) [P.65] : +-*/% [P.67] : = [P.68] : ,
More informationFY.DOC
高 职 高 专 21 世 纪 规 划 教 材 C++ 程 序 设 计 邓 振 杰 主 编 贾 振 华 孟 庆 敏 副 主 编 人 民 邮 电 出 版 社 内 容 提 要 本 书 系 统 地 介 绍 C++ 语 言 的 基 本 概 念 基 本 语 法 和 编 程 方 法, 深 入 浅 出 地 讲 述 C++ 语 言 面 向 对 象 的 重 要 特 征 : 类 和 对 象 抽 象 封 装 继 承 等 主
More information新・明解C言語入門編『索引』
!... 75!=... 48 "... 234 " "... 9, 84, 240 #define... 118, 213 #include... 148 %... 23 %... 23, 24 %%... 23 %d... 4 %f... 29 %ld... 177 %lf... 31 %lu... 177 %o... 196 %p... 262 %s... 242, 244 %u... 177
More informationMicrosoft Word - 把时间当作朋友(2011第3版)3.0.b.06.doc
2 5 8 11 0 13 1. 13 2. 15 3. 18 1 23 1. 23 2. 26 3. 28 2 36 1. 36 2. 39 3. 42 4. 44 5. 49 6. 51 3 57 1. 57 2. 60 3. 64 4. 66 5. 70 6. 75 7. 83 8. 85 9. 88 10. 98 11. 103 12. 108 13. 112 4 115 1. 115 2.
More informationC
C 2017 3 14 1. 2. 3. 4. 2/95 C 1. 3/95 C I 1 // talkback.c: 2 #include 3 #include 4 #define DENSITY 62.4 5 int main(void) 6 { 7 float weight, volume; 8 int size; 9 unsigned long letters;
More informationC/C++ - 字符输入输出和字符确认
C/C++ Table of contents 1. 2. getchar() putchar() 3. (Buffer) 4. 5. 6. 7. 8. 1 2 3 1 // pseudo code 2 read a character 3 while there is more input 4 increment character count 5 if a line has been read,
More informationC/C++程序设计 - 字符串与格式化输入/输出
C/C++ / Table of contents 1. 2. 3. 4. 1 i # include # include // density of human body : 1. 04 e3 kg / m ^3 # define DENSITY 1. 04 e3 int main ( void ) { float weight, volume ; int
More information新・解きながら学ぶC言語
330!... 67!=... 42 "... 215 " "... 6, 77, 222 #define... 114, 194 #include... 145 %... 21 %... 21 %%... 21 %f... 26 %ld... 162 %lf... 26 %lu... 162 %o... 180 %p... 248 %s... 223, 224 %u... 162 %x... 180
More informationC++ 程式設計
C C 料, 數, - 列 串 理 列 main 數串列 什 pointer) 數, 數, 數 數 省 不 不, 數 (1) 數, 不 數 * 料 * 數 int *int_ptr; char *ch_ptr; float *float_ptr; double *double_ptr; 數 (2) int i=3; int *ptr; ptr=&i; 1000 1012 ptr 數, 數 1004
More informationC C
C C 2017 3 8 1. 2. 3. 4. char 5. 2/101 C 1. 3/101 C C = 5 (F 32). 9 F C 4/101 C 1 // fal2cel.c: Convert Fah temperature to Cel temperature 2 #include 3 int main(void) 4 { 5 float fah, cel; 6 printf("please
More informationC/C++ 语言 - 循环
C/C++ Table of contents 7. 1. 2. while 3. 4. 5. for 6. 8. (do while) 9. 10. (nested loop) 11. 12. 13. 1 // summing.c: # include int main ( void ) { long num ; long sum = 0L; int status ; printf
More informationC 1
C homepage: xpzhangme 2018 5 30 C 1 C min(x, y) double C // min c # include # include double min ( double x, double y); int main ( int argc, char * argv []) { double x, y; if( argc!=
More informationC/C++语言 - C/C++数据
C/C++ C/C++ Table of contents 1. 2. 3. 4. char 5. 1 C = 5 (F 32). 9 F C 2 1 // fal2cel. c: Convert Fah temperature to Cel temperature 2 # include < stdio.h> 3 int main ( void ) 4 { 5 float fah, cel ;
More informationchap07.key
#include void two(); void three(); int main() printf("i'm in main.\n"); two(); return 0; void two() printf("i'm in two.\n"); three(); void three() printf("i'm in three.\n"); void, int 标识符逗号分隔,
More information02
Thinking in C++: Volume One: Introduction to Standard C++, Second Edition & Volume Two: Practical Programming C++ C C++ C++ 3 3 C C class C++ C++ C++ C++ string vector 2.1 interpreter compiler 2.1.1 BASIC
More informationnooog
C : : : , C C,,, C, C,, C ( ), ( ) C,,, ;,, ; C,,, ;, ;, ;, ;,,,, ;,,, ; : 1 9, 2 3, 4, 5, 6 10 11, 7 8, 12 13,,,,, 2008 1 1 (1 ) 1.1 (1 ) 1.1.1 ( ) 1.1.2 ( ) 1.1.3 ( ) 1.1.4 ( ) 1.1.5 ( ) 1.2 ( ) 1.2.1
More information( CIP) /. :, ( ) ISBN TP CIP ( 2005) : : : : * : : 174 ( A ) : : ( 023) : ( 023)
( CIP) /. :, 2005. 2 ( ) ISBN 7-5624-3339-9.......... TP311. 1 CIP ( 2005) 011794 : : : : * : : 174 ( A ) :400030 : ( 023) 65102378 65105781 : ( 023) 65103686 65105565 : http: / /www. cqup. com. cn : fxk@cqup.
More informationC
C 2017 4 1 1. 2. while 3. 4. 5. for 6. 2/161 C 7. 8. (do while) 9. 10. (nested loop) 11. 12. 3/161 C 1. I 1 // summing.c: 2 #include 3 int main(void) 4 { 5 long num; 6 long sum = 0L; 7 int status;
More informationuntitled
串 串 例 : char ch= a ; char str[]= Hello ; 串 列 ch=getchar(); scanf( %c,&ch); 串 gets(str) scanf( %s,str); 8-1 數 ASCII 例 : char ch= A ; printf( %d,ch); // 65 A ascii =0x41 printf( %c,ch); // A 例 : char ch;
More informationCC213
: (Ken-Yi Lee), E-mail: feis.tw@gmail.com 177 [P179] (1) - [P181] [P182] (2) - for [P183] (3) - switch [P184] [P187] [P189] [P194] 178 [ ]; : : int var; : int var[3]; var 2293620 var[0] var[1] 2293620
More information1 LINUX IDE Emacs gcc gdb Emacs + gcc + gdb IDE Emacs IDE C Emacs Emacs IDE ICE Integrated Computing Environment Emacs Unix Linux Emacs Emacs Emacs Un
Linux C July 27, 2016 Contents 1 Linux IDE 1 2 GCC 3 2.1 hello.c hello.exe........................... 5 2.2............................... 9 2.2.1 -Wall................................ 9 2.2.2 -E..................................
More informationuntitled
MPICH anzhulin@sohu.com 1 MPICH for Microsoft Windows 1.1 MPICH for Microsoft Windows Windows NT4/2000/XP Professional Server Windows 95/98 TCP/IP MPICH MS VC++ 6.x MS VC++.NET Compaq Visual Fortran 6.x
More informationプログラムの設計と実現II
UNIX C ls mkdir man http://www.tj.chiba-u.jp/lecture/prog2/ Ctrl+x, Ctrl+s ( )..[4]% gcc Wall o hoge hoge.c..[5]%./hoge 1 : 1 2 : 2 3 : 3 4 : 0 6..[6]% (! )..[4]% gcc Wall o hoge hoge.c..[5]%!g gcc Wall
More informationuntitled
1-1 1-2 1-3 1-4 1-5 1-6 1-7 1-8 1-1-1 C int main(void){ int x,y,z; int sum=0; double avg=0.0; scanf("%d",&x) ; scanf("%d",&y) ; scanf("%d",&z) ; sum=x+y+z ; avg=sum/3.0; printf("%f\n",avg); system("pause");
More informationint *p int a 0x00C7 0x00C7 0x00C int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++;
Memory & Pointer trio@seu.edu.cn 2.1 2.1.1 1 int *p int a 0x00C7 0x00C7 0x00C7 2.1.2 2 int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++; 2.1.3 1. 2. 3. 3 int A,
More information学习MSP430单片机推荐参考书
MSP430 16 MSP430 C MSP430 C MSP430 FLASH 16 1 CPU 16 ALU 16 PC SP SR R4~R15 2 3 00-FFH 100-1FFH 4 5 1 2 51 24 27 6 1 2 3 4 5 6 4 12 SR SP SR CPU SR CPU C Z N GIE CPUOff CPU OscOff SCG0 SCG1 CPU EXIT SP
More information1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File
51 C 51 51 C C C C C C * 2003-3-30 pnzwzw@163.com C C C C KEIL uvision2 MCS51 PLM C VC++ 51 KEIL51 KEIL51 KEIL51 KEIL 2K DEMO C KEIL KEIL51 P 1 1 1 1-1 - 1 Project New Project 1 2 Windows 1 3 N C test
More informationuntitled
1 1.1 1.2 1.3 1.4 1.5 ++ 1.6 ++ 2 BNF 3 4 5 6 7 8 1.2 9 1.2 IF ELSE 10 1.2 11 1.2 12 1.3 Ada, Modula-2 Simula Smalltalk-80 C++, Objected Pascal(Delphi), Java, C#, VB.NET C++: C OOPL Java: C++ OOPL C# C++
More informationC/C++语言 - 分支结构
C/C++ Table of contents 1. if 2. if else 3. 4. 5. 6. continue break 7. switch 1 if if i // colddays.c: # include int main ( void ) { const int FREEZING = 0; float temperature ; int cold_ days
More information华恒家庭网关方案
LINUX V1.5 1 2 1 2 LINUX WINDOWS PC VC LINUX WINDOWS LINUX 90% GUI LINUX C 3 REDHAT 9 LINUX PC TFTP/NFS http://www.hhcn.com/chinese/embedlinux-res.html minicom NFS mount C HHARM9-EDU 1 LINUX HHARM9-EDU
More information新版 明解C++入門編
511!... 43, 85!=... 42 "... 118 " "... 337 " "... 8, 290 #... 71 #... 413 #define... 128, 236, 413 #endif... 412 #ifndef... 412 #if... 412 #include... 6, 337 #undef... 413 %... 23, 27 %=... 97 &... 243,
More information新・解きながら学ぶJava
481! 41, 74!= 40, 270 " 4 % 23, 25 %% 121 %c 425 %d 121 %o 121 %x 121 & 199 && 48 ' 81, 425 ( ) 14, 17 ( ) 128 ( ) 183 * 23 */ 3, 390 ++ 79 ++ 80 += 93 + 22 + 23 + 279 + 14 + 124 + 7, 148, 16 -- 79 --
More information第3章.doc
3 3 3 3.1 3 IT Trend C++ Java SAP Advantech ERPCRM C++ C++ Synopsys C++ NEC C C++PHP C++Java C++Java VIA C++ 3COM C++ SPSS C++ Sybase C++LinuxUNIX Motorola C++ IBM C++Java Oracle Java HP C++ C++ Yahoo
More information科学计算的语言-FORTRAN95
科 学 计 算 的 语 言 -FORTRAN95 目 录 第 一 篇 闲 话 第 1 章 目 的 是 计 算 第 2 章 FORTRAN95 如 何 描 述 计 算 第 3 章 FORTRAN 的 编 译 系 统 第 二 篇 计 算 的 叙 述 第 4 章 FORTRAN95 语 言 的 形 貌 第 5 章 准 备 数 据 第 6 章 构 造 数 据 第 7 章 声 明 数 据 第 8 章 构 造
More informationC/C++语言 - 运算符、表达式和语句
C/C++ Table of contents 1. 2. 3. 4. C C++ 5. 6. 7. 1 i // shoe1.c: # include # define ADJUST 7. 64 # define SCALE 0. 325 int main ( void ) { double shoe, foot ; shoe = 9. 0; foot = SCALE * shoe
More information6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C C C51 C51 ANSI C MCS-51 C51 ANSI C C C51 bit Byte bit sbit
6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C51 6.1 C51 6.1.1 C51 C51 ANSI C MCS-51 C51 ANSI C C51 6.1 6.1 C51 bit Byte bit sbit 1 0 1 unsigned char 8 1 0 255 Signed char 8 11 128
More information, 7, Windows,,,, : ,,,, ;,, ( CIP) /,,. : ;, ( 21 ) ISBN : -. TP CIP ( 2005) 1
21 , 7, Windows,,,, : 010-62782989 13501256678 13801310933,,,, ;,, ( CIP) /,,. : ;, 2005. 11 ( 21 ) ISBN 7-81082 - 634-4... - : -. TP316-44 CIP ( 2005) 123583 : : : : 100084 : 010-62776969 : 100044 : 010-51686414
More informationMicrosoft Word - 把时间当作朋友(2011第3版)3.0.b.07.doc
2 5 8 11 0 1. 13 2. 15 3. 18 1 1. 22 2. 25 3. 27 2 1. 35 2. 38 3. 41 4. 43 5. 48 6. 50 3 1. 56 2. 59 3. 63 4. 65 5. 69 13 22 35 56 6. 74 7. 82 8. 84 9. 87 10. 97 11. 102 12. 107 13. 111 4 114 1. 114 2.
More informationCC213
: (Ken-Yi Lee), E-mail: feis.tw@gmail.com 9 [P.11] : Dev C++ [P.12] : http://c.feis.tw [P.13] [P.14] [P.15] [P.17] [P.23] Dev C++ [P.24] [P.27] [P.34] C / C++ [P.35] 10 C / C++ C C++ C C++ C++ C ( ) C++
More informationuntitled
A, 3+A printf( ABCDEF ) 3+ printf( ABCDEF ) 2.1 C++ main main main) * ( ) ( ) [ ].* ->* ()[] [][] ** *& char (f)(int); ( ) (f) (f) f (int) f int char f char f(int) (f) char (*f)(int); (*f) (int) (
More informationC/C++ - 数组与指针
C/C++ Table of contents 1. 2. 3. 4. 5. 6. 7. 8. 1 float candy [ 365]; char code [12]; int states [50]; 2 int array [6] = {1, 2, 4, 6, 8, 10}; 3 // day_mon1.c: # include # define MONTHS 12 int
More informationuntitled
3 C++ 3.1 3.2 3.3 3.4 new delete 3.5 this 3.6 3.7 3.1 3.1 class struct union struct union C class C++ C++ 3.1 3.1 #include struct STRING { typedef char *CHARPTR; // CHARPTR s; // int strlen(
More information2013 C 1 #include <stdio.h> 2 int main(void) 3 { 4 int cases, i; 5 long long a, b; 6 scanf("%d", &cases); 7 for (i = 0; i < cases; i++) 8 { 9 scanf("%
2013 ( 28 ) ( ) 1. C pa.c, pb.c, 2. C++ pa.cpp, pb.cpp Compilation Error long long cin scanf Time Limit Exceeded 1: A 10 B 1 C 1 D 5 E 5 F 1 G II 5 H 30 1 2013 C 1 #include 2 int main(void) 3
More informationebook8-30
3 0 C C C C C C++ C + + C++ GNU C/C++ GNU egcs UNIX shell s h e l l g a w k P e r l U N I X I / O UNIX shell awk P e r l U N I X C C C C C C U N I X 30.1 C C U N I X 70 C C U N I X U N I X U N I X C Dennis
More information1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10
Java V1.0.1 2007 4 10 1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10 6.2.10 6.3..10 6.4 11 7.12 7.1
More information51 C 51 isp 10 C PCB C C C C KEIL
http://wwwispdowncom 51 C " + + " 51 AT89S51 In-System-Programming ISP 10 io 244 CPLD ATMEL PIC CPLD/FPGA ARM9 ISP http://wwwispdowncom/showoneproductasp?productid=15 51 C C C C C ispdown http://wwwispdowncom
More informationMicrosoft PowerPoint - ds-1.ppt [兼容模式]
http://jwc..edu.cn/jxgl/ HomePage/Default.asp 2 说 明 总 学 时 : 72( 学 时 )= 56( 课 时 )+ 16( 实 验 ) 行 课 时 间 : 第 1 ~14 周 周 学 时 : 平 均 每 周 4 学 时 上 机 安 排 待 定 考 试 时 间 : 课 程 束 第 8 11 12 章 的 内 容 为 自 学 内 容 ; 目 录 中 标 有
More informationC/C++ - 字符串与字符串函数
C/C++ Table of contents 1. 2. 3. 4. 1 char C 2 char greeting [50] = " How " " are " " you?"; char greeting [50] = " How are you?"; 3 printf ("\" Ready, go!\" exclaimed John."); " Ready, go!" exclaimed
More information四川省普通高等学校
四 川 省 普 通 高 等 学 校 计 算 机 应 用 知 识 和 能 力 等 级 考 试 考 试 大 纲 (2013 年 试 行 版 ) 四 川 省 教 育 厅 计 算 机 等 级 考 试 中 心 2013 年 1 月 目 录 一 级 考 试 大 纲 1 二 级 考 试 大 纲 6 程 序 设 计 公 共 基 础 知 识 6 BASIC 语 言 程 序 设 计 (Visual Basic) 9
More informationuntitled
Introduction to Programming ( 數 ) Lecture 3 Spring 2005 March 4, 2005 Lecture 2 Outline 數 料 If if 狀 if 2 (Standard Output, stdout): 料. ((Standard Input, stdin): 料. 類 數 數 數 說 printf 見 數 puts 串 數 putchar
More informationebook15-C
C 1 1.1 l s ( 1 ) - i i 4. 14 - d $ l s -ldi /etc/. /etc/.. - i i 3077 drwxr-sr-x 7 bin 2048 Aug 5 20:12 /etc/./ 2 drwxr-xr-x 13 root 512 Aug 5 20:11 /etc/../ $ls -ldi /. /..... i 2 2 drwxr-xr-x 13 root
More informationC C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40
C C trio@seu.edu.cn C C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40 Week3 C Week5 Week5 Memory & Pointer
More informationuntitled
1 5 IBM Intel 1. IBM 第 1/175 页 第 2/175 页 第 3/175 页 80 第 4/175 页 2. IBM 第 5/175 页 3. (1) 第 6/175 页 第 7/175 页 第 8/175 页 = = 第 9/175 页 = = = = = 第 10/175 页 = = = = = = = = 3. (2) 第 11/175 页 第 12/175 页 第 13/175
More information2013 C 1 # include <stdio.h> 2 int main ( void ) 3 { 4 int cases, a, b, i; 5 scanf ("%d", & cases ); 6 for (i = 0;i < cases ;i ++) 7 { 8 scanf ("%d %d
2013 18 ( ) 1. C pa.c, pb.c, 2. C++ pa.cpp, pb.cpp, Compilation Error cin scanf Time Limit Exceeded 1: A 5 B 5 C 5 D 5 E 5 F 5 1 2013 C 1 # include 2 int main ( void ) 3 { 4 int cases, a, b,
More informationC
C 14 2017 5 31 1. 2. 3. 4. 5. 2/101 C 1. ( ) 4/101 C C ASCII ASCII ASCII 5/101 C 10000 00100111 00010000 ASCII 10000 31H 30H 30H 30H 30H 1 0 0 0 0 0 ASCII 6/101 C 7/101 C ( ) ( ) 8/101 C UNIX ANSI C 9/101
More informationWindows RTEMS 1 Danilliu MMI TCP/IP QEMU i386 QEMU ARM POWERPC i386 IPC PC104 uc/os-ii uc/os MMI TCP/IP i386 PORT Linux ecos Linux ecos ecos eco
Windows RTEMS 1 Danilliu MMI TCP/IP 80486 QEMU i386 QEMU ARM POWERPC i386 IPC PC104 uc/os-ii uc/os MMI TCP/IP i386 PORT Linux ecos Linux ecos ecos ecos Email www.rtems.com RTEMS ecos RTEMS RTEMS Windows
More informationuntitled
1 Outline 類别 欄 (1) 類 類 狀 更 易 類 理 若 類 利 來 利 using 來 namespace 類 ; (2) namespace IBM class Notebook namespace Compaq class Notebook 類别 類 來 類 列 欄 (field) (property) (method) (event) 類 例 立 來 車 類 類 立 車 欄 料
More informationMicrosoft PowerPoint - plan06.ppt
程 序 设 计 语 言 原 理 Principle of Programming Languages 裘 宗 燕 北 京 大 学 数 学 学 院 2012.2~2012.6 6. 基 本 控 制 抽 象 子 程 序 抽 象 子 程 序 活 动 和 局 部 环 境 静 态 实 现 模 型 一 般 实 现 模 型 调 用 序 列 和 在 线 展 开 参 数 机 制 泛 型 子 程 序 异 常 处 理 其
More information目 录
1 Quick51...1 1.1 SmartSOPC Quick51...1 1.2 Quick51...1 1.3 Quick51...2 2 Keil C51 Quick51...4 2.1 Keil C51...4 2.2 Keil C51...4 2.3 1 Keil C51...4 2.4 Flash Magic...9 2.5 ISP...9 2.6...10 2.7 Keil C51...12
More information1
1 2 3 4 5 GNUDebugger 6 7 void main(int argc, char **argv){ vulncpy(argv[1]); return; } void vulncpy(char *a){ char buf[30]; strcpy(buf, a); return; } *argv[1] buf Shellcode *argv[1]... &buf &buf 8 strcpy
More informationepub83-1
C++Builder 1 C + + B u i l d e r C + + B u i l d e r C + + B u i l d e r C + + B u i l d e r 1.1 1.1.1 1-1 1. 1-1 1 2. 1-1 2 A c c e s s P a r a d o x Visual FoxPro 3. / C / S 2 C + + B u i l d e r / C
More informationextend
(object oriented) Encapsulation Inheritance Polymorphism Dynamic Binding (base class) (derived class) 1 class Base { int I; void X(); void Y(); class Derived: public Base { private: int j; void z(); Derived
More information_汪_文前新ok[3.1].doc
普 通 高 校 本 科 计 算 机 专 业 特 色 教 材 精 选 四 川 大 学 计 算 机 学 院 国 家 示 范 性 软 件 学 院 精 品 课 程 基 金 青 年 基 金 资 助 项 目 C 语 言 程 序 设 计 (C99 版 ) 陈 良 银 游 洪 跃 李 旭 伟 主 编 李 志 蜀 唐 宁 九 李 涛 主 审 清 华 大 学 出 版 社 北 京 i 内 容 简 介 本 教 材 面 向
More informationC PICC C++ C++ C C #include<pic.h> C static volatile unsigned char 0x01; static volatile unsigned char 0x02; static volatile unsigned cha
CYPOK CYPOK 1 UltraEdit Project-->Install Language Tool: Language Suite----->hi-tech picc Tool Name ---->PICC Compiler Executable ---->c:hi-picinpicc.exe ( Command-line Project-->New Project-->File Name--->myc
More informationebook14-4
4 TINY LL(1) First F o l l o w t o p - d o w n 3 3. 3 backtracking parser predictive parser recursive-descent parsing L L ( 1 ) LL(1) parsing L L ( 1 ) L L ( 1 ) 1 L 2 L 1 L L ( k ) k L L ( 1 ) F i r s
More information[改訂新版]C言語による標準アルゴリズム事典
iii C 1991 SEND + MORE = MONEY C 100 2003 Java 2003 27 PC-9800 C BMP SVG EPS BMPSVG WindowsMacLinux Web iv int main() int main(void) EXIT_SUCCESS 0 https://github.com/okumuralab/ algo-c TEX TEX PDF PDF
More informationMicrosoft Word - 第3章.doc
Java C++ Pascal C# C# if if if for while do while foreach while do while C# 3.1.1 ; 3-1 ischeck Test() While ischeck while static bool ischeck = true; public static void Test() while (ischeck) ; ischeck
More informationebook50-15
15 82 C / C + + Developer Studio M F C C C + + 83 C / C + + M F C D L L D L L 84 M F C MFC DLL M F C 85 MFC DLL 15.1 82 C/C++ C C + + D L L M F C M F C 84 Developer Studio S t u d i o 292 C _ c p l u s
More informationuntitled
8086/8088 CIP /. 2004.8 ISBN 7-03-014239-X.... TP313 CIP 2004 086019 16 100717 http://www.sciencep.com * 2004 8 2004 8 1 5 500 787 1092 1/16 16 1/2 391 000 1 2 ii 1 2 CAI CAI 3 To the teacher To the student
More informationOracle Solaris Studio makefile C C++ Fortran IDE Solaris Linux C/C++/Fortran IDE "Project Properties" IDE makefile 1.
Oracle Solaris Studio 12.2 IDE 2010 9 2 8 9 10 11 13 20 26 28 30 32 33 Oracle Solaris Studio makefile C C++ Fortran IDE Solaris Linux C/C++/Fortran IDE "Project Properties" IDE makefile 1. "File" > "New
More informationuntitled
1 Outline 數 料 數 數 列 亂數 練 數 數 數 來 數 數 來 數 料 利 料 來 數 A-Z a-z _ () 不 數 0-9 數 不 數 SCHOOL School school 數 讀 school_name schoolname 易 不 C# my name 7_eleven B&Q new C# (1) public protected private params override
More informationC语言的应用.PDF
AVR C 9 1 AVR C IAR C, *.HEX, C,,! C, > 9.1 AVR C MCU,, AVR?! IAR AVR / IAR 32 ALU 1KBytes - 8MBytes (SPM ) 16 MBytes C C *var1, *var2; *var1++ = *--var2; AVR C 9 2 LD R16,-X ST Z+,R16 Auto (local
More informationuntitled
1 DBF (READDBF.C)... 1 2 (filetest.c)...2 3 (mousetes.c)...3 4 (painttes.c)...5 5 (dirtest.c)...9 6 (list.c)...9 1 dbf (readdbf.c) /* dbf */ #include int rf,k,reclen,addr,*p1; long brec,erec,i,j,recnum,*p2;
More information用户大会 论文集2.2.doc
MagGis MapGis GIS MagGis API DLL MapGis VC++ VB BC++ Delphi., Windows API MapGis VC++V Delphi Delphi Delphi MapGis Delphi Delphi Windows Delphi Delphi MapGis MapGis DLL API MapGis function _InitWorkArea(HINST:Integer):Integer;
More informationC/C++ - 结构体、共用体、枚举体
C/C++ Table of contents 1. 2. 3. 4. 5. 6. 7. 8. 1 C C (struct) C 2 C C (struct) C 2 i // book.c: # include < stdio.h> # define MAX_ TITLE 41 # define MAX_ AUTHOR 31 struct book { char title [ MAX_ TITLE
More informationC 1 # include <stdio.h> 2 int main ( void ) { 4 int cases, i; 5 long long a, b; 6 scanf ("%d", & cases ); 7 for (i = 0;i < cases ;i ++) 8 { 9
201 201 21 ( ) 1. C pa.c, pb.c, 2. C++ pa.cpp, pb.cpp Compilation Error long long cin scanf Time Limit Exceeded 1: A 1 B 1 C 5 D RPG 10 E 10 F 1 G II 1 1 201 201 C 1 # include 2 int main ( void
More informationebook15-10
1 0 10.1 U N I X V 7 4. 3 B S D S V R 3 P O S I X. 1 100 % 10.2 S I G S I G A B RT a b o r t S I G A L R M a l a r m V 7 1 5 S V R 4 4. 3 + B S D 31 < s i g n a l. h > 0 10. 9 k i l l 0 P O S I X. 1 D
More informationMicrosoft Word - 970617cppFinalSolution.doc
國 立 台 灣 海 洋 大 學 資 訊 工 程 系 C++ 程 式 設 計 期 末 考 參 考 答 案 姓 名 : 系 級 : 學 號 : 97/06/17 考 試 時 間 :10:00 12:10 試 題 敘 述 蠻 多 的, 看 清 楚 題 目 問 什 麼, 針 對 重 點 回 答 是 很 重 要 的 ; 不 確 定 的 請 一 定 要 當 場 提 出 來, 不 要 白 花 力 氣 在 誤 會
More informationKillTest 质量更高 服务更好 学习资料 半年免费更新服务
KillTest 质量更高 服务更好 学习资料 http://www.killtest.cn 半年免费更新服务 Exam : 310-065Big5 Title : Sun Certified Programmer for the Java 2 Platform, SE 6.0 Version : Demo 1 / 14 1. 35. String #name = "Jane Doe"; 36. int
More information碩命題橫式
一 解釋名詞 :(50%) 1. Two s complement of an integer in binary 2. Arithmetic right shift of a signed integer 3. Pipelining in instruction execution 4. Highest and lowest layers in the TCP/IP protocol suite
More informationMicrosoft Word - CPE考生使用手冊160524.docx
大 學 程 式 能 力 檢 定 (CPE) 考 生 使 用 手 冊 2016 年 5 月 24 日 這 份 手 冊 提 供 給 參 加 CPE 檢 定 考 試 的 考 生 內 容 包 含 考 試 環 境 的 使 用, 以 及 解 題 時 所 使 用 I/O 的 基 本 知 識 1. 如 欲 報 名 參 加 CPE 考 試, 請 先 於 CPE 網 站 完 成 帳 號 註 冊, 然 後 再 報 名 該
More information3.1 num = 3 ch = 'C' 2
Java 1 3.1 num = 3 ch = 'C' 2 final 3.1 final : final final double PI=3.1415926; 3 3.2 4 int 3.2 (long int) (int) (short int) (byte) short sum; // sum 5 3.2 Java int long num=32967359818l; C:\java\app3_2.java:6:
More informationmvc
Build an application Tutor : Michael Pan Application Source codes - - Frameworks Xib files - - Resources - ( ) info.plist - UIKit Framework UIApplication Event status bar, icon... delegation [UIApplication
More information附錄C.doc
C C C-1 C -2 C -3 C -4 C -5 / C -6 2 C/C++ C-1 FILE* fopen(const char* filename, const char* mode) filename NULL FILE* freopen(const
More information2015年计算机二级(C语言)模拟试题及答案(四)
2016 年 计 算 机 二 级 (C 语 言 ) 模 拟 试 题 及 答 案 (4) 一 填 空 题 1 C 语 言 中 基 本 的 数 据 类 型 有 : 2 C 语 言 中 普 通 整 型 变 量 的 类 型 说 明 符 为, 在 内 存 中 占 字 节, 有 符 号 普 通 整 型 的 数 据 范 围 是 3 整 数 -35 在 机 内 的 补 码 表 示 为 4 执 行 下 列 语 句 int
More information第5章修改稿
(Programming Language), ok,, if then else,(), ()() 5.0 5.0.0, (Variable Declaration) var x : T x, T, x,,,, var x : T P = x, x' : T P P, () var x:t P,,, yz, var x : int x:=2. y := x+z = x, x' : int x' =2
More information6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM
CHAPTER 6 SQL SQL SQL 6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM 3. 1986 10 ANSI SQL ANSI X3. 135-1986
More informationWWW PHP
WWW PHP 2003 1 2 function function_name (parameter 1, parameter 2, parameter n ) statement list function_name sin, Sin, SIN parameter 1, parameter 2, parameter n 0 1 1 PHP HTML 3 function strcat ($left,
More information提纲 1 2 OS Examples for 3
第 4 章 Threads2( 线程 2) 中国科学技术大学计算机学院 October 28, 2009 提纲 1 2 OS Examples for 3 Outline 1 2 OS Examples for 3 Windows XP Threads I An Windows XP application runs as a seperate process, and each process may
More informationMicrosoft Word - 01.DOC
第 1 章 JavaScript 简 介 JavaScript 是 NetScape 公 司 为 Navigator 浏 览 器 开 发 的, 是 写 在 HTML 文 件 中 的 一 种 脚 本 语 言, 能 实 现 网 页 内 容 的 交 互 显 示 当 用 户 在 客 户 端 显 示 该 网 页 时, 浏 览 器 就 会 执 行 JavaScript 程 序, 用 户 通 过 交 互 式 的
More informationuntitled
不 料 料 例 : ( 料 ) 串 度 8 年 數 串 度 4 串 度 數 數 9- ( ) 利 數 struct { ; ; 數 struct 數 ; 9-2 數 利 數 C struct 數 ; C++ 數 ; struct 省略 9-3 例 ( 料 例 ) struct people{ char name[]; int age; char address[4]; char phone[]; int
More informationApplication Note Format
USB 說 2 - AD PWM Office: 6F, No. 12, Innovation 1st. RD., Science-Based Industrial Park, Hsin-Chu City, Taiwan, R.O.C Tel: +886-3-6661766 ext.1672 Fax: +886-3-6661765 Etoms Electronics Corp. Publication
More informationuntitled
MODBUS 1 MODBUS...1 1...4 1.1...4 1.2...4 1.3...4 1.4... 2...5 2.1...5 2.2...5 3...6 3.1 OPENSERIAL...6 3.2 CLOSESERIAL...8 3.3 RDMULTIBIT...8 3.4 RDMULTIWORD...9 3.5 WRTONEBIT...11 3.6 WRTONEWORD...12
More informationPs22Pdf
( 98 ) C ( ) ( )158 1998 C : C C C,,, C,, : C ( ) : : (, 100084) : : : 7871092 1/ 16 :18 25 :415 : 2000 3 1 2000 3 1 : ISBN 7 302 01166 4/ T P432 : 00016000 : 22 00 ( 98 ) 20 90,,, ;,,, 1994, 1998, 160,
More informationBOOL EnumWindows(WNDENUMPROC lparam); lpenumfunc, LPARAM (Native Interface) PowerBuilder PowerBuilder PBNI 2
PowerBuilder 9 PowerBuilder Native Interface(PBNI) PowerBuilder 9 PowerBuilder C++ Java PowerBuilder 9 PBNI PowerBuilder Java C++ PowerBuilder NVO / PowerBuilder C/C++ PowerBuilder 9.0 PowerBuilder Native
More informationepub 33-8
8 1) 2) 3) A S C I I 4 C I / O I / 8.1 8.1.1 1. ANSI C F I L E s t d i o. h typedef struct i n t _ f d ; i n t _ c l e f t ; i n t _ m o d e ; c h a r *_ n e x t ; char *_buff; /* /* /* /* /* 1 5 4 C FILE
More information