Visit for more Learning Resources

Slides:



Advertisements
Similar presentations
C Language.
Advertisements

Programming In C++ Spring Semester 2013 Lecture 2 Programming In C++, Lecture 2.
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.
Principles of Programming Fundamental of C Programming Language and Basic Input/Output Function 1.
C Programming Language 4 Developed in 1972 by Dennis Ritchie at AT&T Bell Laboratories 4 Used to rewrite the UNIX operating system 4 Widely used on UNIX.
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Introduction to C language
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Lecture No: 16. The scanf() function In C programming language, the scanf() function is used to read information from standard input device (keyboard).
Copyrights© 2008 BVU Amplify DITM Software Engineering & Case Tools Page:1 INTRODUCTION TO ‘C’ LANGUAGE Chapter 2.
Chapter 2 : Overview of C By Suraya Alias. /*The classic HelloWorld */ #include int main(void) { printf(“Hello World!!"); return 0; }
C Tokens Identifiers Keywords Constants Operators Special symbols.
/* Documentations */ Pre process / Linking statements Global declarations; main( ) { Local Declarations; Program statements / Executable statements; }
Constants Numeric Constants Integer Constants Floating Point Constants Character Constants Expressions Arithmetic Operators Assignment Operators Relational.
Dennis Ritchie 1972 AT & T Bell laboratories (American Telephone and Telegraph) USA 1www.gowreeswar.com.
Khalid Rasheed Shaikh Computer Programming Theory 1.
CSC141 Introduction to Computer Programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture - 6.
Types of Operator Arithmetic operator Relational operator Logical operator Assignment operator Increment or decrement operator(unary) Bitwise operator.
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
Scott Marino MSMIS Kean University MSAS5104 Programming with Data Structures and Algorithms Week 1 Scott Marino.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
BASIC C PROGRAMMING LANGUAGE TUTORIAL infobizzs.com.
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.
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.
SCP1103 Basic C Programming SEM1 2010/2011 Arithmetic Expressions Week 5.
Introduction to ‘c’ language
Arithmetic Expressions
CSCE 206 Structured Programming in C
‘C’ Programming Structures and Commands
INC 161 , CPE 100 Computer Programming
Chapter 2 - Introduction to C Programming
LESSON 3 IO, Variables and Operators
Objectives Identify the built-in data types in C++
C Fundamentals & Pointers
Introduction to C++.
Getting Started with C.
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
Visit for more Learning Resources
Introduction to C Programming Language
' C ' PROGRAMMING SRM-MCA.
Chapter 2 - Introduction to C Programming
Computer Programming: C language
Introduction to C Programming
11/10/2018.
Buy book Online -
Buy book Online -
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
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,
Chapter 2 - Introduction to C Programming
Introduction to C Programming
Govt. Polytechnic,Dhangar
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.
Chapter 2 - Introduction to C Programming
C ( Programming Language ) PSK Technologies By: Arti Sontakke An ISO 9001:2015 (QMS) Certified IT Company Computer Education | Software Development | Computer.
Chapter 2 - Introduction to C Programming
C Programming Language
C – Programming Language
CSCE 206 Lab Structured Programming in C
DATA TYPES There are four basic data types associated with variables:
Course Outcomes of Programming In C (PIC) (17212, C203):
Introduction to C Programming
Basic Programming Lab C.
Getting Started With Coding
Visit for more Learning Resources
Introduction to C Programming
Presentation transcript:

Visit for more Learning Resources

Introduction to ‘C’ ‘C’ is a programming language. It is strong, simple and reliable. Buy book Online - www.icebreakerspublications.com

History Of ‘C’ C ‘ programming was written by Dennis Ritchie in 1972. It was developed at AT & T’s Bell Laboratories in USA. Buy book Online - www.icebreakerspublications.com

‘C’ Tokens Buy book Online - www.icebreakerspublications.com

‘C’ Constants int m = 56; Here, 56 is Constant and m is Variable. Types of Constants : Primary Constants Secondary Constants Type Example Integer Constants +226 , -946 Real Constants +123.23, -22.34 Character Constants ‘G’ , ‘5’ , ‘+’ Buy book Online - www.icebreakerspublications.com

‘C’ Data Types int a = 2 ; Data type Variable Constant Types of data types: Primary Data Type Secondary Data Type Primary Data Type : character, integer, float, double, void Secondary Data Type : arrays, pointer, structures, union, enum. Buy book Online - www.icebreakerspublications.com

Variables int a = 2 ; Data type Variable Constant Definition of Variable: Variables in C are memory locations that are given names. Variables are the entities which can change at different times we use variables to store data in memory. As shown in figure, a is variable. Buy book Online - www.icebreakerspublications.com

‘C’ Keywords Keywords are the words whose meaning has already been explained to the C compiler. The following names are reserved by the C language. Their meaning is already defined, and they cannot be re-defined. Buy book Online - www.icebreakerspublications.com

Operators Definition : Operators are the Symbols used to indicate the operations on the operands. e.g. 10+20 ------- 10 & 20 are operands and + is an operator Type of Operators 1)Arithmetic 3)Logical 5)Conditional 7)Special 2)Relational 4)Assignment 6)Bitwise 8)Increment / Decrement Buy book Online - www.icebreakerspublications.com

Pre-processor Directive Pre-processor directive is #define. #define MAX 10 #define is generally used to define constant values It is generally written in upper case like MAX It never terminates with semicolon Buy book Online - www.icebreakerspublications.com

Main Function void main() : Syntax: void main() { ---- ---- Declarative Or Executable Statements } void main() : Used to start of actual C program. It includes two parts as declarative Statements and executable Statements. Buy book Online - www.icebreakerspublications.com

Basic Structure Of ‘C’ Program Document Section Links Section (File) Definition Section Global variable declaration Section void main() { Variable declaration section Function declaration section executable statements; } Function definition 1 Function definition 2 --------------------- --------------------- (User Defined Functions) Function definition n Buy book Online - www.icebreakerspublications.com

My First ‘C’ Program #include <stdio.h> int main() { /* my first program in C */ printf("Hello, World! \n"); return 0; } Buy book Online - www.icebreakerspublications.com

Printf printf (“format string”, variable1, variable2 …) ; Printf : It is a function used for displaying a value or a data on the screen. printf (“format string”, variable1, variable2 …) ; Syntax : Format String Meaning Example Result %d Prints a Decimal Integer int num=5; printf(“%d",num); 5 %c Prints a single character char ch=’r’; printf(“%c”,ch); R %f Prints a float value float num=14.44; printf(“%f”,num); 14.44 %s Prints a String char str[]="icebreakers”; printf(“%s”,str); Icebreakers Buy book Online - www.icebreakerspublications.com

Scanf scanf (“format string”, &variable1, &variable2 …) ; Printf : It is a function used for accepting a value or a data from keyboard. scanf (“format string”, &variable1, &variable2 …) ; Syntax : Format String Meaning Example Result %d Reads a Decimal Integer scanf(“%d",&num); %d accepts the digit number from user and it will get stored in num’ variable. %c Reads a single character scanf(“%c”,&ch); %c accepts the character from user and it will get stored in ‘ch’ variable. %f Reads a float value scanf(“%f”,&num); %f accepts the float number from user and it will get stored in num variable. %s Reads a String scanf(“%s”,str); ( & is not required) %s accepts the string from user and it will get stored in ‘str’ variable.

Solved Programs #include<stdio.h> //including the header file Program 1 : First Program in C to wish Hello World to user. #include<stdio.h> //including the header file #include<conio.h> int main() { clrscr(); //Clear the output screen char name[10]; //variable declaration Output: printf (“Enter Name::”); Scanf(“%s”,name); //Displaying the message //Accepting the data Enter Name::icebreakers Hello icebreakers printf(“\nHello %s”,name); getch(); screen return 0; } //function for quick output Buy book Online - www.icebreakerspublications.com

For more detail contact us Solved Programs Program 2 : c program to print integer #include<stdio.h> //including the header file #include<conio.h> //including the header file int main() { clrscr(); //Clear the output screen Int a; //variable declaration Output: Enter an integer printf("Enter an integer\n"); //Displaying the message Scanf(“%d”,&a); //Accepting the data 45 Integer the you have printf("Integer that you have entered is %d\n", a); entered is 45 getch(); screen return 0; } //function for quick output For more detail contact us Buy book Online - www.icebreakerspublications.com