the c programming language

12
The C Programming Language Bryn Bodayle & Grant Yentzer

Upload: bryn-bodayle

Post on 24-Dec-2014

463 views

Category:

Technology


3 download

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

Page 1: The C Programming Language

The C Programming LanguageBryn Bodayle & Grant Yentzer

Page 2: The C Programming Language

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

Page 3: The C Programming Language

That which comes after B

C

Page 4: The C Programming Language

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

Page 5: The C Programming Language

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

Page 6: The C Programming Language

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?

Page 7: The C Programming Language

C, C++, C#, Java Objective-c

Page 8: The C Programming Language

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

Page 9: The C Programming Language

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");

Page 10: The C Programming Language

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"

Page 11: The C Programming Language

Why we chose C?

Page 12: The C Programming Language