Download presentation
Presentation is loading. Please wait.
Published byLindsay Hunter Modified over 9 years ago
1
CSCI 1730 March 27 th, 2012
2
Text System Programming with C and Unix by Hoover Ch 1: Introduction Ch 2: Bits, Bytes and Data Types Ch 3: Arrays and Strings Ch 4: Pointers and Structures Ch 5: Input/Output Ch 6: Program Management Ch 7: System Calls Ch 8: Libraries Ch 9: Scripting Languages
3
HW: Read chapters 1 and 2
4
Common shell commands cd pwd set which
5
Common system commands grep ls man more time sort
6
Read sections in Ch. 1: Text editors & how to use (we’ve covered this) How to debug try out the sample programs provides Program development
8
C review – 4 data types /* A review of the basic data types in C. (pg 36) */ #include int main() { intx,y; chara; floatf,e; doubled; x=4; y=7; a='H'; f=-3.4; d=54.123456789; e=54.123456789; printf("%d %c %f %lf\n",x,a,e,d); printf("%d %c %.9f %.9lf\n",x,a,e,d); }
9
C review – arithmetic /* A review of the basic arithmetic operators in C. (pg 37) */ #include int main() { int x,y; int r1,r2,r3,r4,r5; x=4; y=7; r1=x+y; r2=x-y; r3=x/y; r4=x*y; printf("%d %d %d %d\n",r1,r2,r3,r4); r3++; r4--; r5=r4%r1; printf("%d %d %d\n",r3,r4,r5); }
10
C review – loops #include /* A review of the loop types in C. (pg 38) */ int main() { int i,x; x=0; for (i=0; i<4; i++) { x=x+i; printf("%d\n",x); } while (i<7) { x=x+i; i++; printf("%d\n",x); } do { x=x+i; i++; printf("%d\n",x); } while (i<9); }
11
C review – blocks /* A review of conditionals and blocks in C. (pg 39) */ #include int main() { int i,x; x=0; for (i=0; i<5; i++) { if (i%2 == 0 || i == 1) x=x+i; else x=x-i; printf("%d\n",x); }
12
C review – flow control /* A review of flow control statements in C. (pg 40) */ #include int main() { int i,x; x=0; for (i=0; i<5; i++) { if (i%2 == 0) continue; x=x-i; if (i%4 == 0) break; printf("%d\n",x); }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.