12
ACTIVE LEARNING ASSIGNMENT TOPIC: INTRODUCTION TO “C”

Cpu.ppt INTRODUCTION TO “C”

Embed Size (px)

Citation preview

Page 1: Cpu.ppt INTRODUCTION TO “C”

ACTIVE LEARNING ASSIGNMENT

TOPIC: INTRODUCTION TO “C”

Page 2: Cpu.ppt INTRODUCTION TO “C”

History Of C• Created By Dennis Ritchie At Bell Labs In 1972• Originally Created To Design And Support The Unix

Operating System.• C Compilers Are Available For Virtually Every

Platform• In 1983 The American National Standards Institute

(ANSI) Standardized C to be called ANSI Standard C.• ANSI C Programs That You Write Should Work With

Any ANSI C Compiler.

Page 3: Cpu.ppt INTRODUCTION TO “C”

Features of C• Efficient & Fast.• Variety Of Data Types & Powerful Operators.• Highly Portable.• Well Suited For Structured Programming.• Its Ability To Extend Itself.• A Collection Of Functions.

Page 4: Cpu.ppt INTRODUCTION TO “C”

Use Of C• Operating Systems• Language Compilers• Assemblers• Text Editors• Print Spoolers• Network Drivers• Modern Programs

Page 5: Cpu.ppt INTRODUCTION TO “C”

Data Types• Different Types Of Variables Allow The Storing Different

Types Of Data, Hence The Name “Data Types”

• E.g. If You Had To Store The Numbers 10 And 10.0, C Provides Two Different Data Types.

Page 6: Cpu.ppt INTRODUCTION TO “C”

Basics Of Variableschar: A Single Byte, Holds One Character e.g. The Letter ‘a’,

Although They are Stored As Integer Values Standardized As ASCII Numbers

int: An Integer Of Fixed Length, Usually 4 bytes / 32 bits. E.g. The Number 10 Can Be Stored In A Variable Of Type Int.

float: Single-Precision Floating Point. e.g. The Number 10.67

double: Same As A float But With Double Precision

Page 7: Cpu.ppt INTRODUCTION TO “C”

Basic Things For C • Link Section- It Contains Header File. Mainly Two Header

Files:- • 1 > stdio.h:-Standard Input Output Header File(For printf,

scanf, etc.)• 2> conio.h:-Console Input Output Header File(For clrscr(),

getch(), etc.) • Main Function:- It Contains Main Logic Of The Program.

Page 8: Cpu.ppt INTRODUCTION TO “C”

Sample Program Of C

Page 9: Cpu.ppt INTRODUCTION TO “C”
Page 10: Cpu.ppt INTRODUCTION TO “C”

C Tokens

• C Tokens Are The Basic Buildings Blocks In C Language Which Are Constructed Together To Write A C Program.

• Each And Every Smallest Individual Units In A C Program Are Known As C Tokens.

Page 11: Cpu.ppt INTRODUCTION TO “C”

C Tokens Example Program:

• int main(){int x, y, total;x = 10, y = 20;total = x + y;Printf (“Total = %d \n”, total);}

C Tokens Are Of Six Types• Keywords               (eg: int)• Identifiers               (eg: main, total)• Constants              (eg: 10, 20)• Strings                    (eg: “total”,)• Special symbols  (eg: (), {})• Operators              (eg: +, /,-,*)                                  

Page 12: Cpu.ppt INTRODUCTION TO “C”

THANK YOU