C Language By Sra Sontisirikit 49541212.

Slides:



Advertisements
Similar presentations
Chapter 4 Constructors and Destructors. Objectives Constructors – introduction and features The zero-argument constructor Parameterized constructors Creating.
Advertisements

User Defined Functions
Introduction to C Programming CE Lecture 1 Introduction to C.
Unix Continuum of Tools Do something once: use the command line Do something many times: –Use an alias –Use a shell script Do something that is complex.
CS1061 C Programming Lecture 2: A Few Simple Programs A. O’Riordan, 2004.
1 Modularity In “C”. 2 General Syntax data_type function_Name (parameter list) { … return expression; // return output } Body of the function is a compound.
1 ICS103 Programming in C Lecture 2: Introduction to C (1)
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
Functions in C. Function Terminology Identifier scope Function declaration, definition, and use Parameters and arguments Parameter order, number, and.
Computer Science 210 Computer Organization Introduction to C.
“C” Programming Language CIS 218. Description C is a procedural languages designed to provide lowlevel access to computer system resources, provide language.
C Programming language
Programming With C.
History of C 1950 – FORTRAN (Formula Translator) 1959 – COBOL (Common Business Oriented Language) 1971 – Pascal Between Ada.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
C LANGUAGE Characteristics of C · Small size
Computer Programming A simple example /* HelloWorld: A simple C program */ #include int main (void) { printf (“Hello world!\n”); return.
CMPE13Cyrus Bazeghi 1 Chapter 11 Introduction to Programming in C.
An overview of C Language. Overview of C C language is a general purpose and structured programming language developed by 'Dennis Ritchie' at AT &T's.
Functions, Part 1 of 3 Topics  Using Predefined Functions  Programmer-Defined Functions  Using Input Parameters  Function Header Comments Reading 
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Chapter 1 slides1 What is C? A high-level language that is extremely useful for engineering computations. A computer language that has endured for almost.
Introduction to C Topics Compilation Using the gcc Compiler
‘C’ Programming Structures and Commands
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2017
Computer Science 210 Computer Organization
Introduction to C Language
C Programming Hardik H. Maheta.
C Language VIVA Questions with Answers
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
History of ‘C’ Root of the morden language is ALGOL It’s first
Quiz 11/15/16 – C functions, arrays and strings
Introduction to C Topics Compilation Using the gcc Compiler
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Hector Cen Fall 2017
Introduction to C Topics Compilation Using the gcc Compiler
C Basics.
Introduction to C Programming Language
Programmazione I a.a. 2017/2018.
Choice of Programming Language
2011/11/20: Lecture 15 CMSC 104, Section 4 Richard Chang
Visit for more Learning Resources
جامعة البحر الاحمر كلية العلوم التطبيقية قسم الفيزياء التطبيقية الفصل الداسي الثاني IIالمقرر: حاسوب د. خالد عثمان العالم.
CSC 253 Lecture 8.
Computer Science 210 Computer Organization
2008/11/05: Lecture 15 CMSC 104, Section 0101 John Y. Park
CSC 253 Lecture 8.
CSI-121 Structured Programming Language Lecture 14 Functions (Part 2)
Basic C++ What’s a declaration? What’s a definition?
תכנות מערכות בשפת C מבוא מכללת אורט כפר-סבא אורי וולטמן
User Defined Functions
Functions I Creating a programming with small logical units of code.
សេចក្តីផ្តើមពី Programming
Functions, Part 1 of 3 Topics Using Predefined Functions
جامعة البحر الاحمر كلية العلوم التطبيقية قسمي الحاسوب وتقنية المعلومات الفصل الداسي الثاني المقرر: اساليب برمجة 1 محاضرة رقم 1 د. خالد عثمان العالم.
Govt. Polytechnic,Dhangar
Introduction to C Topics Compilation Using the gcc Compiler
Your first C and C++ programs
Introduction to C Topics Compilation Using the gcc Compiler
Functions, Part 1 of 3 Topics Using Predefined Functions
In C Programming Language
The C Language: Intro.
C – Programming Language
Functions, Part 1 of 3 Topics Using Predefined Functions
2008/11/05: Lecture 15 CMSC 104, Section 0101 John Y. Park
Introduction to C Topics Compilation Using the gcc Compiler
Course Outcomes of Programming In C (PIC) (17212, C203):
Functions I Creating a programming with small logical units of code.
Scope Rules.
Introduction to C CS 3410.
Presentation transcript:

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 Provide low-level access to memory Require minimal run-time support

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

type function_name (parameters) { local variables   C Statements   }

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; }

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

Variables

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.