1 / 9

C Language

C Language. By Sra Sontisirikit 49541212. 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. Goals and Purpose. Straightforward language

Download Presentation

C Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. C Language By Sra Sontisirikit 49541212

  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> 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.

More Related