C Programming language

Slides:



Advertisements
Similar presentations
CSE 105 Structured Programming Language (C)
Advertisements

Introduction to C Programming
Symbol Table.
Overview of programming in C C is a fast, efficient, flexible programming language Paradigm: C is procedural (like Fortran, Pascal), not object oriented.
Fundamentals of Computer and programming in C Programming Languages, Programs and Programming Rohit Khokher.
Kernighan/Ritchie: Kelley/Pohl:
Lecture 2 Introduction to C Programming
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.
1 CS 161 Introduction to Programming and Problem Solving Chapter 9 C++ Program Components Herbert G. Mayer, PSU Status 10/20/2014.
Introduction to C Programming CE Lecture 1 Introduction to C.
COMP1180 Review Date: 4 March, 2009 Time: 10:30am - 12:20pm Venue: –CS students -- FSC801C and FSC801D –IS and other students -- OEE1017 Remarks: – 1)
CS1061 C Programming Lecture 2: A Few Simple Programs A. O’Riordan, 2004.
Topic R3 – Review for the Final Exam. CISC 105 – Review for the Final Exam Exam Date & Time and Exam Format The final exam is 120-minutes, closed- book,
CS100A, Fall 1997, Lectures 221 CS100A, Fall 1997 Lecture 22, Tuesday 18 November Introduction To C Goal: Acquire a reading knowledge of basic C. Concepts:
1 ICS103 Programming in C Lecture 2: Introduction to C (1)
Guide To UNIX Using Linux Third Edition
Introduction to C Programming
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
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.
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
By Sidhant Garg.  C was developed between by Dennis Ritchie at Bell Laboratories for use with the Unix Operating System.  Unlike previously.
C Programming Tutorial – Part I CS Introduction to Operating Systems.
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.
Introduction to Computer Programming Using C Session 23 - Review.
/* Documentations */ Pre process / Linking statements Global declarations; main( ) { Local Declarations; Program statements / Executable statements; }
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
1 Programming in C Hello World! Soon I will control the world! Soon I will control the world!
C Programming language Basic Concepts Prepared By The Smartpath Information systems
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
Introduction to Programming
CECS 130 EXAM 1. To declare a constant (read only) value: const int x = 20; const float PI = 3.14; Can we do this? const int x;
Anatomy of the simplest C Program Sen Zhang SUNY Oneonta Oneonta, NEW YORK © 2004
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
Announcements Assignment 1 due Wednesday at 11:59PM Quiz 1 on Thursday 1.
Silberschatz and Galvin  C Programming Language Kingdom of Saudi Arabia Ministry of Higher Education Al-Majma’ah University College of Education.
C is a high level language (HLL)
Department of Electronic & Electrical Engineering Statements Blocks{} Semicolons ; Variables Names keywords Scope.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
BASIC C PROGRAMMING LANGUAGE TUTORIAL infobizzs.com.
Arrays An array is a sequence of objects all of which have the same type. The objects are called the elements of the array and are numbered consecutively.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
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.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
Computer Science 210 Computer Organization
Introduction to the C Language
Chapter 2 - Introduction to C Programming
Java Primer 1: Types, Classes and Operators
C Language By Sra Sontisirikit
History of ‘C’ Root of the morden language is ALGOL It’s first
Getting Started with C.
Chapter 2 - Introduction to C Programming
C programming language
Visit for more Learning Resources
Computer Science 210 Computer Organization
Introduction to the C Language
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
The C Language: Intro.
C Language B. DHIVYA 17PCA140 II MCA.
Course Outcomes of Programming In C (PIC) (17212, C203):
CPS125.
Presentation transcript:

C Programming language " ‘white book’ or ‘K&R’ "

C Language Programming History UNIX developed c. 1969 -- DEC PDP-7 Assembly Language. BCPL -- a user friendly OS providing powerful development tools developed from BCPL. Assembler tedious long and error prone. A new language ``B'' a second attempt. c. 1970. A totally new language ``C'' a successor to ``B''. c. 1971. By 1973 UNIX OS almost totally written in ``C''.

C Language Design Goals It to be compiled using a relatively straightforward compiler. Provide low-level access to memory. Provide language constructs that map efficiently to machine instructions. Require minimal run-time support. C was therefore useful for many applications that had formerly been coded in assembly language.

C Language Characteristics C has facilities for structured programming and allows lexical variable scope and recursion. Parameters of C functions are always passed by value. Pass-by-reference is achieved in C by explicitly passing pointer values. C program source text is free-format, using semicolon as a statement terminator (not a delimiter).

More Specific Characteristics Non-nestable function definitions, although variables may be hidden in nested blocks. Partially weak typing; for instance, characters can be used as integers. Array indexing as a secondary notion, defined in terms of pointer arithmetic. Function pointers allowing for a rudimentary form of closures and runtime polymorphism.

C Program Structure A C program basically has the following form : Preprocessor Commands Type definitions Function prototypes -- declare function types and variables passed to function. Variables Functions

C language Function C programming must have a main() function. A function has the form : type function_name (parameters) { local variables   C Statements }

C Language Variables C has the following simple data types : To declare a variable in C, do :     var_type list variables;

Defining Global Variables Global variables are defined above main() in the following way Example : short number,sum; int bignumber,bigsum; char letter;   main() {   }

Printing Out and Inputting Variables C uses formatted output. The printf function has a special formatting character (%) -- a character following this defines a certain format for a variable : %c -- characters %d -- integers %f -- floats     e.g. printf(``%c %d %f'',ch,i,x); Scanf() is the function for inputting values to a data structure: Its format is similar to printf : i.e. scanf(``%c %d %f'',&ch,&i,&x);  

Using C Language Programming C's primary use is for "system programming", including implementing operating systems and embedded system applications. C has also been widely used to implement end-user applications. C source code is then input to a C compiler, which then outputs finished machine or object code. One consequence of C's wide acceptance and efficiency is that the compilers, libraries, and interpreters of other higher-level languages are often implemented in C.