C Language B. DHIVYA 17PCA140 II MCA.

Slides:



Advertisements
Similar presentations
Variables in C Amir Haider Lecturer.
Advertisements

Overview of programming in C C is a fast, efficient, flexible programming language Paradigm: C is procedural (like Fortran, Pascal), not object oriented.
C++ Basics Variables, Identifiers, Assignments, Input/Output.
Chapter 3: Beginning Problem Solving Concepts for the Computer Programming Computer Programming Skills /1436 Department of Computer Science.
IntroductionIntroduction  Computer program: an ordered sequence of statements whose objective is to accomplish a task.  Programming: process of planning.
Introduction to Computing Lecture 01: Introduction to C Introduction to Computing Lecture 01: Introduction to C Assist.Prof.Dr. Nükhet ÖZBEK Ege University.
Structure of a C program
C Programming Basics Lecture 5 Engineering H192 Winter 2005 Lecture 05
CS1061 C Programming Lecture 4: Indentifiers and Integers A.O’Riordan, 2004.
Guide To UNIX Using Linux Third Edition
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.
COMPUTER PROGRAMMING. Data Types “Hello world” program Does it do a useful work? Writing several lines of code. Compiling the program. Executing the program.
C Tokens Identifiers Keywords Constants Operators Special symbols.
C-Language Keywords(C99)
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
Fundamentals of C and C++ Programming. EEL 3801 – Lotzi Bölöni Sub-Topics  Basic Program Structure  Variables - Types and Declarations  Basic Program.
CS212: Object Oriented Analysis and Design Lecture 2: Introduction to C++
Dennis Ritchie 1972 AT & T Bell laboratories (American Telephone and Telegraph) USA 1www.gowreeswar.com.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 5P. 1Winter Quarter C Programming Basics.
VARIABLES, CONSTANTS, OPERATORS ANS EXPRESSION
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 5P. 1Winter Quarter C Programming Basics Lecture 5.
Data Structure and c K.S.Prabhu Lecturer All Deaf Educational Technology.
Types of C Variables:  The following are some types of C variables on the basis of constants values it has. For example: ○ An integer variable can hold.
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
Silberschatz and Galvin  C Programming Language Kingdom of Saudi Arabia Ministry of Higher Education Al-Majma’ah University College of Education.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
CMSC 104, Version 8/061L09VariablesInC.ppt Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement Reading.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
C++ Lesson 1.
Asst.Prof.Dr. Tayfun ÖZGÜR
The Machine Model Memory
Basics (Variables, Assignments, I/O)
Data types Data types Basic types
BASIC ELEMENTS OF A COMPUTER PROGRAM
LESSON 3 IO, Variables and Operators
C Fundamentals & Pointers
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
C Short Overview Lembit Jürimägi.
Introduction to C Programming Language
By: Syed Shahrukh Haider
CMSC 104, Section 4 Richard Chang
CSE101-Lec#3 Components of C Identifiers and Keywords Data types.
2008/10/01: Lecture 8 CMSC 104, Section 0101 John Y. Park
CMSC 104, Section 4 Richard Chang
Basics (Variables, Assignments, I/O)
Advanced Programming Basics
Introduction to Programming
Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Character Set Uppercase Alphabets A,
פרטים נוספים בסילבוס של הקורס
Variables in C Topics Naming Variables Declaring Variables
Basics of ‘C’.
פרטים נוספים בסילבוס של הקורס
Govt. Polytechnic,Dhangar
Variables, Identifiers, Assignments, Input/Output
Variables in C Topics Naming Variables Declaring Variables
UMBC CMSC 104 – Section 01, Fall 2016
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.
Variables in C Declaring , Naming, and Using Variables.
2. Second Step for Learning C++ Programming • Data Type • Char • Float
Programming Language C Language.
Module 2 Variables, Data Types and Arithmetic
Programming Languages and Paradigms
Building Blocks of C Programming Language
Variables in C Topics Naming Variables Declaring Variables
2008/10/01: Lecture 8 CMSC 104, Section 0101 John Y. Park
Variables in C Topics Naming Variables Declaring Variables
Variables in C Topics Naming Variables Declaring Variables
INTRODUCTION TO C.
Variables in C Topics Naming Variables Declaring Variables
Presentation transcript:

C Language B. DHIVYA 17PCA140 II MCA

About C C was invented to write an operating system called UNIX. C is a successor of B language, which was introduced around 1970. The language was formalized in 1988 by the American National Standard Institute. (ANSI). The UNIX OS was totally written in C by 1973.

C Program Structure A C program basically consists of the following parts: Preprocessor Commands Functions Variables Statements & Expressions Comments

Identifiers A C identifier is a name used to identify a variable, function, or any other user-defined item. An identifier starts with a letter A to Z or a to z or an underscore _ followed by zero or more letters, underscores, and digits (0 to 9). C does not allow punctuation characters such as @, $, and % within identifiers. C is a case sensitive programming language.

Keywords The following list shows the reserved words in C. auto else Long switch break enum register typedef case extern return union char float short unsigned const for signed void continue goto sizeof volatile default if static while do int double

Data Types In the C programming language, data types refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.

Data Types Types and Description : 1. Basic Types: They are arithmetic types and consists of the two types: (a) integer types and (b) floating-point types. 2. Enumerated types: They are again arithmetic types and they are used to define variables that can only be assigned certain discrete integer values throughout the program. 3. The type void: The type specifier void indicates that no value is available. 4. Derived types: They include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types and (e) Function types.

Variables A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C has a specific type, which determines the size and layout of the variable's memory;

Variables Types: Char : Typically a single octet(one byte). This is an integer type. int : The most natural size of integer for the machine. Float : A single-precision floating point value. Double : A double-precision floating point value. Void : Represents the absence of type.

Operators C language is rich in built-in operators and provides the following types of operators: Arithmetic Operators Relational Operators Logical Operators Bitwise Operators Assignment Operators Misc Operators

Decision Making in C if statement if...else statement The if...else if...else Statement Nested if statements switch statement

Loops while for do…..while nested loops

Functions Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions. A function declaration tells the compiler about a function's name, return type, and parameters. A function definition provides the actual body of the function.

Scope of Variables Types: Local Variables Global Variables Register Variable Static Variable

Arrays An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.

Arrays Declaring Arrays: To declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows: type arrayName [ arraySize ]; Example: int a [10];

Files A file represents a sequence of bytes, does not matter if it is a text file or binary file. C programming language provides access on high level functions as well as low level (OS level) calls to handle file on your storage devices.

Files FILE *fopen( const char * filename, const char * mode ); Opening Files: FILE *fopen( const char * filename, const char * mode ); Closing a File: int fclose( FILE *fp ); Writing a File: int fputc( int c, FILE *fp ); Reading a File: int fgetc( FILE * fp );

THANK YOU