bash-4.3$ date Mon Apr 17 12:56:16 EDT 2017 bash-4.3$ pwd /home/accts/sbs5/cs223/www/current/lectures bash-4.3$ cd code bash-4.3$ ./lp0417 b is 0 bash-4.3$ make lp0417 gcc -g3 -std=gnu99 -pedantic -Wall -lm lp0417.c -o lp0417 bash-4.3$ ./lp0417 b is 5 bash-4.3$ cat lp0417.c #include int main() { int a=1; int b = 5; switch(a) { b=20; case 1: printf("b is %d\n",b); break; default:printf("b is %d\n",b); break; } return 0; } bash-4.3$ ./lp0417b i : 10 sizeof(i++) is: 4 i : 10 bash-4.3$ cat lp0417b.c #include int f(int j){ return j; } int main() { int i; i = 10; printf("i : %d\n",i); printf("sizeof(i++) is: %lu\n",sizeof(i++)); printf("f(%d) is: %d\n",i, f(i++)); printf("i : %d\n",i); return 0; } bash-4.3$ make lp0417b gcc -g3 -std=gnu99 -pedantic -Wall -lm lp0417b.c -o lp0417b lp0417b.c: In function ‘main’: lp0417b.c:12:33: warning: operation on ‘i’ may be undefined [-Wsequence-point] printf("f(%d) is: %d\n",i, f(i++)); ~^~ bash-4.3$ ./lp0417b i : 10 sizeof(i++) is: 4 f(11) is: 10 i : 11 bash-4.3$ pwd /home/accts/sbs5/cs223/www/current/lectures/code bash-4.3$ ls AVLmain hw6 lp0306.c mccdp.c~ AVLmain.c lis.c lp0308 mt AVLmain.h lis.h lp0308.c mygetLine AVLtree lis.o lp0327 mygetLine.c AVLtree.c lis_test lp0327.c myString AVLtree.h lis_test.c lp0329 myString.c AVLtree.o lis_test.o lp0329.c myString.h AVLtree.output lists lp0403 printArgs badDoubler.c lists2 lp0403.c printArgs.c btreeint lists2.c lp0403.c~ __pycache__ btreeintargs lists.c lp0405 queuetest btreeintargs.c liststest lp0405.c queuetest.c btreeint.c liststest.c lp0405.c~ queuetest.o examplehash lookingAtPointers lp0410 random examplehash2 lookingAtPointers.c lp0410.c random.c examplehash2.c lp0118 lp0410.c~ rb examplehash.c lp0118.c lp0412 rbarg exhash lp0120 lp0412.c rbarg.cpp exhash2 lp0120.c lp0412.c~ rbarg.cpp~ exhash2.c lp0123 lp0417 rb.cpp exhash.c lp0123.c lp0417b rb.cpp~ fib lp0125 lp0417b.c stacklist fib2 lp0125.c lp0417b.c~ stacklist.c fib2.c lp0206 lp0417.c stacknotes fib2.c~ lp0206.c lp0417.c~ stack.py fib.c lp0208.c Makefile struct fib.c~ lp0213 mcc struct2 fib.py lp0213.c mccargs struct2.c getLine lp0215 mccargs.c struct3 getLine.c lp0215.c mccargs.c~ struct3.c goodDoubler.c lp0220 mcc.c struct.c heap lp0220.c mcc.c~ sumRange heap.c lp0227 mccdp sumRange.c heapsort lp0227.c mccdpargs tolower heapsort.c lp0301 mccdpargs.c tolower.c hi lp0301.c mccdpargs.c~ hi.c lp0306 mccdp.c bash-4.3$ ./queuetest 3 4 5 -3 -2 -9 -3 Stack: size: 1 :[3] Stack: size: 0 : Stack: size: 2 :[4] [3] Stack: size: 0 : Stack: size: 3 :[5] [4] [3] Stack: size: 0 : Stack: size: 0 : Stack: size: 2 :[4] [5] Stack: size: 0 : Stack: size: 1 :[5] Stack: size: 0 : Stack: size: 0 : queue is empty Stack: size: 0 : Stack: size: 0 : bash-4.3$ ./stacklist push 0 0 push 1 1 0 push 2 2 1 0 push 3 3 2 1 0 push 4 4 3 2 1 0 pop gets 4 3 2 1 0 pop gets 3 2 1 0 pop gets 2 1 0 pop gets 1 0 pop gets 0 bash-4.3$ ./btreeintargs 3 4 5 6 Welcome to btree! Adding 3 Tree height: 1 Size: 2 Adding 4 Tree height: 2 Size: 3 Adding 5 Tree height: 3 Size: 4 Adding 6 Tree height: 4 Size: 5 Preorder: 0 [4] 3 [3] 4 [2] 5 [1] 6 [0] Inorder: 0 [4] 3 [3] 4 [2] 5 [1] 6 [0] Tree: 0 Height: 4 Size: 5 (0x20a4420) 3 Height: 3 Size: 4 (0x20a4440) 4 Height: 2 Size: 3 (0x20a4460) 5 Height: 1 Size: 2 (0x20a4480) 6 Height: 0 Size: 1 (0x20a44a0) bash-4.3$ ./btreeintargs 3 6 4 7 2 Welcome to btree! Adding 3 Tree height: 1 Size: 2 Adding 6 Tree height: 2 Size: 3 Adding 4 Tree height: 3 Size: 4 Adding 7 Tree height: 3 Size: 5 Adding 2 Tree height: 3 Size: 6 Preorder: 0 [3] 3 [2] 2 [0] 6 [1] 4 [0] 7 [0] Inorder: 0 [3] 2 [0] 3 [2] 4 [0] 6 [1] 7 [0] Tree: 0 Height: 3 Size: 6 (0xed8420) 2 Height: 0 Size: 1 (0xed84c0) 3 Height: 2 Size: 5 (0xed8440) 4 Height: 0 Size: 1 (0xed8480) 6 Height: 1 Size: 3 (0xed8460) 7 Height: 0 Size: 1 (0xed84a0) bash-4.3$ pwd /home/accts/sbs5/cs223/www/current/lectures/code bash-4.3$ ./fib2 Usage: fib [integers]+ bash-4.3$ ./fib2 3 5 15 20 fib(3) = 2 Time: 0.000063 memoFib(3) = 2 Time: 0.000001 fib2(3) = 2 Time: 0.000002 fib(5) = 5 Time: 0.000001 memoFib(5) = 5 Time: 0.000000 fib2(5) = 5 Time: 0.000000 fib(15) = 610 Time: 0.000007 memoFib(15) = 610 Time: 0.000000 fib2(15) = 610 Time: 0.000001 fib(20) = 6765 Time: 0.000066 memoFib(20) = 6765 Time: 0.000000 fib2(20) = 6765 Time: 0.000000 bash-4.3$ ./fib2 20 30 40 fib(20) = 6765 Time: 0.000148 memoFib(20) = 6765 Time: 0.000001 fib2(20) = 6765 Time: 0.000016 fib(30) = 832040 Time: 0.007278 memoFib(30) = 832040 Time: 0.000001 fib2(30) = 832040 Time: 0.000002 fib(40) = 102334155 Time: 0.865768 memoFib(40) = 102334155 Time: 0.000001 fib2(40) = 102334155 Time: 0.000002 bash-4.3$ ./fib2 30 40 45 fib(30) = 832040 Time: 0.007322 memoFib(30) = 832040 Time: 0.000002 fib2(30) = 832040 Time: 0.000002 fib(40) = 102334155 Time: 0.866881 memoFib(40) = 102334155 Time: 0.000001 fib2(40) = 102334155 Time: 0.000001 fib(45) = 1134903170 Time: 9.601219 memoFib(45) = 1134903170 Time: 0.000001 fib2(45) = 1134903170 Time: 0.000002 bash-4.3$ exit Process shell finished