15-03-2012, 02:14 PM
Brief Introduction to the C Programming Language
[attachment=18372]
Introduction
The C programming language was designed by Dennis Ritchie at Bell Laboratories in the early 1970s
Influenced by
ALGOL 60 (1960),
CPL (Cambridge, 1963),
BCPL (Martin Richard, 1967),
B (Ken Thompson, 1970)
Traditionally used for systems programming, though this may be changing in favor of C++
Traditional C:
The C Programming Language, by Brian Kernighan and Dennis Ritchie, 2nd Edition, Prentice Hall
Referred to as K&R
Writing C Programs
A programmer uses a text editor to create or modify files containing C code.
Code is also known as source code.
A file containing source code is called a source file.
After a C source file has been created, the programmer must invoke the C compiler before the program can be executed (run).
Input / Output in C
C has no built-in statements for input or output.
A library of functions is supplied to perform these operations. The I/O library functions are listed the “header” file <stdio.h>.
You do not need to memorize them, just be familiar with them.
Formatted Output with printf
Format Conversion Specifiers:
d -- displays a decimal (base 10) integer
l -- used with other specifiers to indicate a "long"
e -- displays a floating point value in exponential notation
f -- displays a floating point value
g -- displays a number in either "e" or "f" format
c -- displays a single character
s -- displays a string of characters