1.62k likes | 1.66k Views
Programming Language C Tutorial Introduction. 主講人:虞台文. Content. Background Getting Started IDE (Integrated Development Environment) Main Parts of C Programs Variables and Arithmetic Expressions The for statement Symbolic Constants Character Input and Output Arrays Functions
E N D
Content • Background • Getting Started • IDE (Integrated Development Environment) • Main Parts of C Programs • Variables and Arithmetic Expressions • The for statement • Symbolic Constants • Character Input and Output • Arrays • Functions • Character Arrays • External Variables and Scope
Textbooks • C How to Program, 5th Edition, by Harvey M. Deitel , Paul J. Deitel. • The C programming Language, 2nd Editon, by Brian W. Kernighan and Dennis M. Ritchie, Prentice-Hall in 1988.
Grading • Homework 40% • Midterm 30% • Final 30% • Other 10%
The C Language • Currently, the most commonly-used language for embedded systems • High-level assembly • Very portable • compilers exist for virtually every processor • Easy-to-understand compilation • Produces efficient code • Fairly concise
The Development of the C Language C History • Developed between 1969 and 1973 along with Unix • Due mostly to Dennis Ritchie • Designed for systems programming • Operating systems • Utility programs • Compilers • Filters • Evolved from B, which evolved from BCPL
CPU ALU Input Device Output Device Input Output Control Memory Computer Architecture
Programming Language CTutorial Introduction Getting Started
%SystemRoot%\system32\cmd.exe /K "F:\VS6\VC98\Bin\VCVARS32.BAT" Setting Program Development Environment
Our First C Program Hello World #include <stdio.h> main() { printf("hello, world\n"); }
Our First C Program Hello World include information about standard library #include <stdio.h> main() { printf("hello, world\n"); } define a function calledmain that received no argumentvalues
Our First C Program Hello World #include <stdio.h> main() { printf("hello, world\n"); } define a function calledmain that received no argumentvalues
Our First C Program Hello World #include <stdio.h> main() { printf("hello, world\n"); } statements of main are enclosed in braces
Our First C Program Hello World #include <stdio.h> main() { printf("hello, world\n"); } main calls library function printf
Exercises • Create some typo errors for Hello.c, and redo the compiling/linking process. Watch and understand the screen output reported by cl. • Add more printf statements in Hello.c and redo the compiling/linking/execution process.