0% found this document useful (0 votes)
76 views28 pages

C Programming Basics: Mr. Ajay B. Kapase

This document provides an overview of the C programming language. It discusses the evolution of programming languages from machine language to assembly language to high-level languages like C. It then covers the basics of C including its history, why it is used, applications, program structure, tokens, identifiers, keywords, and data types. The document is intended to give the reader a high-level introduction to programming in C.

Uploaded by

Ajay Kapase
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views28 pages

C Programming Basics: Mr. Ajay B. Kapase

This document provides an overview of the C programming language. It discusses the evolution of programming languages from machine language to assembly language to high-level languages like C. It then covers the basics of C including its history, why it is used, applications, program structure, tokens, identifiers, keywords, and data types. The document is intended to give the reader a high-level introduction to programming in C.

Uploaded by

Ajay Kapase
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

C programming Basics

Mr. Ajay B. Kapase


Evolution of Programming Languages
• Computer Program: set of instructions that the computer can
perform in order to perform some task.

• Programming: The process of creating a program is called


programming.

• The instructions must be given by following some rules just like


grammar makes up the programming language.
Evolution of Programming Language
• Machine Language:
• The limited set of instructions that a CPU can understand
directly is called machine code.
• sample instruction: 10110000 01100001

• Disadvantage:
• so hard for humans to read and understand
Evolution of Programming Language
• Assembly Language:
• each instruction is identified by a short abbreviation (rather
than a set of bits)
• We can use names and numbers
• Example: mov al, 061h

Assembly Lang. Machine Lang.


Assembler CPU
Evolution of Programming Language
• Drawbacks of Assembly Language:

• Lots of instructions to do even simple tasks.

• individual instructions are somewhat human readable,


understanding entire program is challenging.

• assembly language still isn’t very portable


Evolution of Programming Language
• High-level Languages:
• To address the readability and portability concerns.
• new programming languages such as C, C++, Java etc.
• Simple, highly portable, and readable
• int a = 97;
High-Level Languages
Three Types of Paradigms
• High-Level languages follows 3 types of Paradigms.
• Logic Oriented Programming
• Prolog

• Procedure Oriented Programming


• C, Qbasic etc.

• Object Oriented Programming


• C++, Java etc.
About
• What is C?
• History of C
• Why we use C
• Applications of C
What is C ?
• High Level programming language
• Used to write Computer Softwares / Programs
• Need of C programming language
History of C
• developed by Dennis Ritchie
• At bell labs (AT & T American Telephone & Telegraph) in 1972
• Successor of B language
• Invented to write UNIX operating system
• Entire UNIX O.S is written in C language.
Why Use C?
• C for Mother of all other higher level Programming languages.
• Considered as one of the Basic Programming Language.
• More close to hardware
• Direct access to memory via Pointers
• Faster performance
• Basic Structure
• Provides common syntax to other languages
• C++, Objective C, Golang ,Java etc.
Performance Comparison
Performance Comparison
Applications of C
• Creating Operating System.
• Used to write firmware for embedded applications
• Writing application software.
• Compilers and other system software written in C
• Most of the networking devices Routers, switches
Philosophy of Computer programming

Information Data
Process
Environmental Setup
• Editor
• IDE
• Compiler (cc, gcc, clang, turboc)

• Extension
• .c
C Program Structure:
First C Program (Hello World)
header file section (Preprocessor Section)
Global declaration section
main()
{
declaration part;
executable part;
}
user-defined functions()
{
}
Compilation and Execution

#include …
……………
…………….. Compiler Executable Machine
………………..
………………

C program (.c)
C Program Structure:
First C Program (Hello World)
• Preprocessor Directives
• Functions
• Variables
• Statements & Expressions
• Comments
Tokens
• Smallest elements in C program which are meaningful to compiler.
Tokens
• Example
printf("Hello, World!");
Individual Tokens
1. printf
2. (
3. “Hello, World”
4. )
5. ;
Identifiers
• Name given and used to identify any function or variable
• Rules
• Must start with alphabet (A - Z, a - z) or Underscore (_)
• Can be followed by zero or more alphabets/digits/underscore
• Special characters (@/$/% etc.) not allowed
• Case sensitive
• Example:
Keywords
• words are reserved by C
• Used as standard words in C
• Should not be used as an identifier
• C contains 32 keywords
C Keywords
Data Types in C
• Defines the type of data to be stored
• Used with variables
• Divided into two major types
• Primary / Basic / Built In data Type
• Secondary / data types (created from primary)
Data Types in C
Thank You

You might also like