the c programming language
DESCRIPTION
A presentation I gave with a classmate on the C programming language. We covered the history and reasons development as well as some of the language specifics. This was for a Belmont Programming Languages class.TRANSCRIPT
The C Programming LanguageBryn Bodayle & Grant Yentzer
History of C
1972 at Bell Laboratories
Prior to B, BCPL, and FORTRAN
Unison with UNIX operating system
Finished in 1973
The C Programming Language
That which comes after B
C
Advantages at the Time
Similar syntax to B
Additions of structures and data-types
Block structure, easily understandable
Allows fine control of assembly language, access individual bits of information
Portability allowing for reuse of libraries
Advantages Today
TIOBE ranked as most popular language above Java & Objective-C
Basis for other languages: transferable to other languages
Standardization and continued development
Understand lower level mechanics i.e, arrays
int c = 4;
int y = 0; char value; if(c > 3) { y = c; value = 'A'; } else { c = y; c++; value = 'B'; } return value;
What language is this?
C, C++, C#, Java Objective-c
Assignment Gotchas
Order of functions matter
Pointers and arrays can be confusing
printf("always specifying a line break is annoying \n");
Static scope, static typing, no scope resolution operator, no overloading, no exception handling
Left to right function argument evaluation, short circuit evaluation, unions and structs
Dangling Else int x = 1; if(x != 4) if(x == 3) printf("not reached"); else printf("dangling else reached because the else is automatically attached to the innermost if statement \n");
Unionsunion UnionThing{ int i; char c;};
...
union UnionThing unionThing; unionThing.i = 30; unionThing.c = 'A'; //prints out the value stored in the struct printf("%c \n", unionThing.c); // output is "A" //only one value can be stored in a union at a time, so i is not 30, it is 65 which is A printf("%i \n", unionThing.i); // output is "65"
Why we chose C?