# #

C

The C Programming Language
Brian W.Kernighan Dennis M.Ritchie
C() A Book On C
Al Kelley Ira Pohl

28
C28

Chapter 1 An Overview of C
The C Programming Language Chapter 1 An Overview of C
1.2
– C is terse,it has fewer keywords
– C is structured and modular.
– C is the basis for C++ and Java
– C is portable.Code written on one machine can
be easily moved to another.
< >
>
>
>>
The C Programming Language Chapter 1 An Overview of C
32 keywords ()
auto break case char const
continue default do double else
enum extern float for goto
if int long register return
short signed sizeof static struct
switch typedef unsigned union void
volatile while
<
The C Programming Language Chapter 1 An Overview of C
<
The C Programming Language Chapter 1 An Overview of C
<
The C Programming Language Chapter 1 An Overview of C
Constructed
types
pointers
void
typedef
Character types char
enum
integer
floating single precision floating point float
double precision floating point double
short int
long int
int
arrays
structures
unions
<
The C Programming Language Chapter 1 An Overview of C
Arithmetic
types
1.3
/* example1.1 The first C Program*/
#include <stdio.h>
main()
{
printf(“Hello,World!”);
}
>
notation
Include information
about standard library
define a function named main
statement
output
Hello,World!
The C Programming Language Chapter 1 An Overview of C
/* example1.1 calculate the sum of a and b*/
#include <stdio.h>
/* This is the main program */
main()
{ int a,b,sum;
a=10;
b=24;
sum=add(a,b);
printf(”sum=%d\n",sum);
}
/* This function calculates the sum of x and y */
int add(int x,int y)
{ int z;
z=x+y;
return(z);
}
sum=34
>
The C Programming Language Chapter 1 An Overview of C

< >
main( )
{ ……………….
………………
…………..
…………..
………
……….
……………
…………….
……………….
………………..
}
main( )
{
int i,j,sum;
sum=0;
for(i=1; i<10;i++)
{
for(j=1;j<10;j++)
{
sum+=i*j ;
}
}
printf(“%d \n”,sum);
}
:
TAB
{}
The C Programming Language Chapter 1 An Overview of C


– main()
– mainmain
– C
– ;
– /* */,

< >
/*This is the main /* of example1.1*/ */
The C Programming Language Chapter 1 An Overview of C
1.4 C
C
< >
f i l e,c
f i l e,obj
file.exe
,
*.c
*.obj
,
*.exe
.c,o b j,e x e
The C Programming Language Chapter 1 An Overview of C
– Turbo C
– UNIX,PC-DOS,MS-DOS,UCDOS
– 2M448K RAM
Turbo C

– Install
–,
TC
*.* INCLUDE LIB
*.* SYS *.*
< >
The C Programming Language Chapter 1 An Overview of C
Turbo C
– D:\TC>TC.exe?

FILE,New Load Save Write to
EDIT:/ /
COMPILE LINK MAKE
RUN
Turbo C
– Alt +x
– Alt+F,Q
Help
– F1
– Ctrl+F1
< >
The C Programming Language Chapter 1 An Overview of C
F10-----
F2------
F3------
Alt+F9------Compile
Ctrl+F9------Run
Alt+F5------User Screen

Ctrl+KB------- Ctrl+KK--------
Ctrl+KC------- Ctrl+KV--------
Ctrl+KY------- Ctrl+KH--------
F8-----Step over F7-------Trace into
F4-----Goto Cursor Ctrl+F7--------Add Watch
Ctrl+F8------Toggle Breakpoint Ctrl+F2--------Program Reset
F5-----
F6-----
The C Programming Language Chapter 1 An Overview of C