Introduction to C programming. History of C programming Invented and Developed by Dennis Ritchie and Brian Kernighan at Bell Laboratories in 1972 Predecessor.

Slides:



Advertisements
Similar presentations
Chapter 3: Beginning Problem Solving Concepts for the Computer Programming Computer Programming Skills /1436 Department of Computer Science.
Advertisements

Introduction to C Programming
 2000 Prentice Hall, Inc. All rights reserved. Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line.
C programming.
Introduction to C Programming Overview of C Hello World program Unix environment C programming basics.
1 ICS103 Programming in C Lecture 2: Introduction to C (1)
C Programming Language tutorial Powered by:-
C Programming. Chapter – 1 Introduction Study Book for one month – 25% Learning rate Use Compiler for one month – 60%
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
Lecture No: 16. The scanf() function In C programming language, the scanf() function is used to read information from standard input device (keyboard).
Computer Science 210 Computer Organization Introduction to C.
Introduction to Computer Algorithmics and Programming Ceng 113 Variables and Operators in C.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Outline Variables 1.
Basics of “C” Programming
C Tokens Identifiers Keywords Constants Operators Special symbols.
C Programming Language Bill Jensen CS 354 May, 3 rd 2007.
History of C 1950 – FORTRAN (Formula Translator) 1959 – COBOL (Common Business Oriented Language) 1971 – Pascal Between Ada.
EPSII 59:006 Spring Introduction to C More Administrative Details The C Programming Language How a computer processes programs Your first C program.
C Programming language Basic Concepts Prepared By The Smartpath Information systems
Dennis Ritchie 1972 AT & T Bell laboratories (American Telephone and Telegraph) USA 1www.gowreeswar.com.
C Programming Lecture 7 : Control Structures. Control Structures Conditional statement : if, switch Determine a block of statements to execute depending.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 5P. 1Winter Quarter C Programming Basics Lecture 5.
Principle Prog Revision. Question 1 (a) Identify errors in the following program segment and how the errors can be corrected. void main(){ constant int.
CMPE13Cyrus Bazeghi 1 Chapter 11 Introduction to Programming in C.
Silberschatz and Galvin  C Programming Language Kingdom of Saudi Arabia Ministry of Higher Education Al-Majma’ah University College of Education.
POINTERS IN C Pointer Basics, Pointer Arithmetic, Pointer to arrays and Pointer in functions.
C Part 1 Computer Organization I 1 August 2009 © McQuain, Feng & Ribbens A History Lesson Development of language by Dennis Ritchie at Bell.
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.
2. C FUNDAMENTALS. Example: Printing a Message /* Illustrates comments, strings, and the printf function */ #include int main(void) { printf("To C, or.
 2003 Prentice Hall, Inc. All rights reserved. 1 Basic C++ Programming.
 2003 Prentice Hall, Inc. All rights reserved Basics of a Typical C++ Environment C++ systems –Program-development environment –Language –C++
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 PROGRAMING System Development Mansoura October 2015.
Introduction to C Programming I Subject: T0016 – ALGORITHM AND PROGRAMMING Year: 2013.
From Algorithms to Programs Both are sets of instructions on how to do a task Algorithm: –talking to humans, easy to understand –in plain (English) language.
Module 6 – Decision Control Statements Objectives  Understands Increment/Decrement operators, Conditional and special operators in C  Understands significance.
© Copyright by Deitel 1 Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple.
The Repetition control structure using while loop.
C language--Introduction. History 1970: B by Ken Thompson at AT&T Bell Lab 1972: C by Dennis Ritchie and Ken Tompson at At&T Bell Lab for UNIX 1978: “The.
Computer Science 210 Computer Organization
Computer Programming Techniques Semester 1, 1998
C Language VIVA Questions with Answers
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
Prepared By: G.UshaRani B.Pranalini A.S.Lalitha
Introduction to C Programming Language
CS1101 Computational Engineering
Introduction to C Programming
INTRODUCTION c is a general purpose language which is very closely associated with UNIX for which it was developed in Bell Laboratories. Most of the programs.
Visit for more Learning Resources
Computer Science 210 Computer Organization
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Character Set Uppercase Alphabets A,
Basics of ‘C’.
Chapter 2 - Introduction to C Programming
Introduction to C Programming
Govt. Polytechnic,Dhangar
Introduction to C Topics Compilation Using the gcc Compiler
Introduction C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell.
Govt. Polytechnic,Dhangar
Chapter 2 - Introduction to C Programming
Introduction to C Topics Compilation Using the gcc Compiler
Programs written in C and C++ can run on many different computers
Programming Language C Language.
Capitolo 1 – Introduction C++ Programming
Chapter 2 - Introduction to C Programming
C – Programming Language
C Language B. DHIVYA 17PCA140 II MCA.
Course Outcomes of Programming In C (PIC) (17212, C203):
Introduction to C Programming
Presentation transcript:

Introduction to C programming

History of C programming Invented and Developed by Dennis Ritchie and Brian Kernighan at Bell Laboratories in 1972 Predecessor – BPCL and B language Originally implemented on UNIX system on DEC PDP-11 Feature of C language –Is both a high-level and low-level language UNIX is written in ‘C’

Features of C language - 1 Provides a variety of data types –integer –character –floating-point Other derived data types –pointers –arrays –structure –union Expressions –formed from operators and operands –e.g. assignment, function call –Collectively known as ‘statement’

Features of C language - 2 Provides fundamental control- flow constructions 3 types of control-flow –Sequence structure, e.g., Any assignment expression –Selection structure, e.g. if statement (if-else) statement (switch) statement (while) statement (do-while) statement for statement

Features of C language - 3 Functions ( 函數 ) –May return values of basic types Int, char, float –May be called recursively –Local variables are automatic C program –May exist in separate source files compiled separately –Variables may be Internal to a function External but known only within a single file Visible to entire program

Features of C language - 4 Keywords for ‘C’ - reserved Autobreakcasechar Constcontinue defaultdo double elseenumextern Floatforgotoif intlongregister return Shortsigned sizeof static Structswitchtypedefunion unsigned void volatilewhile

C environment C programs go through 6 steps: 1. edit 2. preprocess 3. compile 4. link 5. load 6. execute

Examples - 1 #include main() { printf(“Welcome “); printf(“to SCE, HKBU\n“); } Preprocessor Main program statement \nReturn \tTab \\Blackslash \”Double quote

Examples - 2 #include main() { int integer1, integer2, sum; /* declaration */ printf(“Enter the first integer\n “); scanf(“”%d”, &integer1”); printf(“to SCE, HKBU“); scanf(“”%d”, &integer2”); sum = integer1 + integer2; /* assignment */ printf(“Sum is %d\n”, sum); }

Examples - 3 If-else control statement #include main() { int n1, n2, sum; printf(“Enter the first integer, and I will tell you\n “); printf(“the relationship they satisfy:”); scanf(“”%d %d”, &n1, &n2”); if (n1 == n2) printf(“%d is equal to %d\n”, n1,n2); if (n1 != n2) printf(“%d is not equal %d\n”,n1,n2); if (n1 < n2) printf(“%d is less than %d\n”,n1,n2); if (n1 > n2) printf(“%d is greater than %d\n”,n1,n2); return 0; }

Examples - 4 While repeat statement #include main() { int num1 = 1; printf(“We count from 1 to 10\n “); while (num1 <= 10) { printf(“We are counting %d. \n”, num1); num1 = num1 + 1; } return 0; }