Presentation is loading. Please wait.

Presentation is loading. Please wait.

C Language By Sra Sontisirikit 49541212.

Similar presentations


Presentation on theme: "C Language By Sra Sontisirikit 49541212."— Presentation transcript:

1 C Language By Sra Sontisirikit

2 Background of C language
C is high level language create in 1972 By Brian W. C. Kernighan & Dennis M. Ritchie Based on two languages : BCPL and B Brian Kernighan Dennis Ritchie

3 Goals and Purpose Straightforward language
Provide low-level access to memory Require minimal run-time support

4 Language Structure and Syntax
A C program basically has the following form: Preprocessor Commands The preprocessor is a program that is invoked by the compiler to process code before compilation. Type definitions Function prototypes -- declare function types and variables passed to function. Variables Functions

5 type function_name (parameters)
{ local variables   C Statements   }

6 Language Structure and Syntax
This is simple program that will print a String #include <stdio.h> int main() { printf("This is my first program in C.\n"); return 0; }

7 #include <stdio.h> int main() {...} printf(...)
This line call "Compiler Directives" to command program to compile file "stdio.h", that use for call method printf. int main() The line int main() declares the main function. Every C program must have a function named main somewhere in the code. {...} The { and } symbols mark the beginning and end of a block of code. In this case, they are for the main method to contain the statements. printf(...) The printf statement is called the format string. It can contain a string such as "This is my first program in C.". And the "/n" symbol is to move the print position to the next line. return 0; This line means the function is ended.

8 Variables

9 Features of the language
Small size Extensive use of function calls Loose typing -- unlike PASCAL Structured language Low level programming readily available Pointer implementation - extensive use of pointers for memory, array, structures and functions.


Download ppt "C Language By Sra Sontisirikit 49541212."

Similar presentations


Ads by Google