What is C??
 C is a programming language developed at AT & T’s Bell Laboratories of USA in 1972.
It was designed and written by a man named Dennis Ritchie.
 C seems so popular is because it is reliable, simple and easy to use.
Getting Started with C:
Communicating with a computer involves speaking the language the
computer understands, which immediately rules out English as the language of communication
with computer. However, there isa close analogy between learning English language and
learning C language.
Alphabets A, B, ….., Y, Z a, b, ……, y, z
Digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Special symbols ~ ‘ ! @ # % ^ & * ( ) _ - + = |  { } [ ] : ; " ' < > , . ? /
Constants, Variables and Keywords:
The alphabets, numbers and special symbols when properly
combined form constants, variables and keywords. Let us see what are ‘constants’ and
‘variables’ in C. A constant is an entity that doesn’t change whereas a variable is an entity that
may change.
Types of C Constants
C constants can be divided into two major categories:
 Primary Constants
Integer Constant
Real Constant
Character Constant
 onstants
Array
Pointer
Structure
Union
Enum, etc.
Rules for Constructing Integer Constants:
1. An integer constant must have at least one digit.
2. It must not have a decimal point.
3. It can be either positive or negative.
4. If no sign precedes an integer constant it is assumed to be positive.
5. No commas or blanks are allowed within an integer constant.
6. The allowable range for integer constants is -32768 to 32767.
Rules for Constructing Real Constants:
 Real constants are often called Floating Point constants. The real constants could be
written in two forms—Fractional form andExponential form.
 Following rules must be observed while constructing real constants expressed in
fractional form:
1. A real constant must have at least one digit.
2. It must have a decimal point.
3. It could be either positive or negative.
4. Default sign is positive.
5. No commas or blanks are allowed within a real constant.
Rules for Constructing Character Constants:
 A character constant is a single alphabet, a single digit or a single special symbol
enclosed within single inverted commas. Both the inverted commas should point to the
left.
For example, ’A’ is a valid character constant whereas ‘A’ is not.
 The maximum length of a character constant can be 1 character.
Ex.: 'A'
'I'
'5'
'='
Types of C Variables
 An entity that may vary during program execution is called a variable. Variable names
are names given to locations in memory. These locations can contain integer, real or
character constants. In any language, the types of variables that it can support depend on
the types of constants that it can handle. This is because a particular type of variable can
hold only the same type of constant.
The rules for constructing different types of constants are different. However, for constructing
variable names of all types the same set of rules apply. These rules are given below;-
Rules for Constructing Variable Names
1. A variable name is any combination of 1 to 31 alphabets, digits or underscores. Some
compilers allow variable names whose length could be up to 247 characters. Still, it
would be safer to stick to the rule of 31 characters. Do not create unnecessarily long
variable names as it adds to your typing effort.
2. The first character in the variable name must be an alphabet or underscore.
3. No commas or blanks are allowed within a variable name.
4. No special symbol other than an underscore (as in gross_sal) can be used in a variable
name.
These rules remain same for all the types of primary and secondary variables.
C Keywords
Keywords are the words whose meaning has already been explained to the C compiler (or
in a broad sense to the computer). The keywords cannot be used as variable names because if we
do so we are trying to assign a new meaning to the keyword, which is not allowed by the
computer. Some C compilers allow you to construct variable names that exactly resemble the
keywords.
There are only 32 keywords available in C.
1. auto
2. double
3. int
4. struct
5. break
6. else
7. long
8. switch
9. case
10.enum
11.register
12.typedef
13.char
14.extern
15.return
16.union
17.const
18.float
19. short
20.unsigned
21.continue
22.for
23.signed
24.void
25.default
26.goto
27.sizeof
28.volatile
29.do
30.if
31.static
32. while

More Related Content

PPTX
Introduction to c
PPTX
Programming Fundamentals
PDF
Lecture 1 introduction of C Programming Language
PDF
Lecture 2
PPT
Welcome to lecture 4 in c programming
DOC
Data type
PPTX
Properties of multiplication web
PDF
Best coding practices to follow - to write a code, like a boss
Introduction to c
Programming Fundamentals
Lecture 1 introduction of C Programming Language
Lecture 2
Welcome to lecture 4 in c programming
Data type
Properties of multiplication web
Best coding practices to follow - to write a code, like a boss

What's hot (15)

PPTX
Variables
PDF
Interview questions
PDF
Geo 2.2 notes
PDF
Overview of C Language
PDF
Basic Symbolic Computation in Perl
PPT
2.1 terms
PPTX
Chapter 03
DOC
Unit 3 quiz spring 2011 print
PPT
Sdd Syntax Descriptions
PDF
DBMS Helping material
PDF
Segmentation of Handwritten Text in Gurmukhi Script
PPTX
Mapping Cardinalities
PPTX
keywords and identifiers
PDF
Intro to Unit 3 - Ratios, 6th grade Math
PDF
Variables
Interview questions
Geo 2.2 notes
Overview of C Language
Basic Symbolic Computation in Perl
2.1 terms
Chapter 03
Unit 3 quiz spring 2011 print
Sdd Syntax Descriptions
DBMS Helping material
Segmentation of Handwritten Text in Gurmukhi Script
Mapping Cardinalities
keywords and identifiers
Intro to Unit 3 - Ratios, 6th grade Math
Ad

Similar to C basics by haseeb khan (20)

PPTX
Introduction to C language programming.pptx
PPSX
Programming in c
PDF
Basic of the C language
PDF
[ITP - Lecture 04] Variables and Constants in C/C++
PDF
Introduction to Computer and Programming - Lecture 03
PDF
Lecture 4 constants_variables
PDF
Introduction
PPT
C presentation book
PPT
Session02 c intro
PPT
All C ppt.ppt
PDF
Constants Variables Datatypes by Mrs. Sowmya Jyothi
PDF
Introduction of c_language
PPTX
Everything C Data Types_copy_With my_name.pptx
PPTX
Data Types and Variables In C Programming
DOCX
C programming tutorial
PPT
C programming language character set keywords constants variables data types
PPTX
Module 1:Introduction
PDF
PSPC--UNIT-2.pdf
PPT
C the basic concepts
PPTX
C Programming Lecture 3 - Elements of C.pptx
Introduction to C language programming.pptx
Programming in c
Basic of the C language
[ITP - Lecture 04] Variables and Constants in C/C++
Introduction to Computer and Programming - Lecture 03
Lecture 4 constants_variables
Introduction
C presentation book
Session02 c intro
All C ppt.ppt
Constants Variables Datatypes by Mrs. Sowmya Jyothi
Introduction of c_language
Everything C Data Types_copy_With my_name.pptx
Data Types and Variables In C Programming
C programming tutorial
C programming language character set keywords constants variables data types
Module 1:Introduction
PSPC--UNIT-2.pdf
C the basic concepts
C Programming Lecture 3 - Elements of C.pptx
Ad

Recently uploaded (20)

PDF
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PPTX
Trending Python Topics for Data Visualization in 2025
PPTX
Tech Workshop Escape Room Tech Workshop
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
Cost to Outsource Software Development in 2025
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
PDF
MCP Security Tutorial - Beginner to Advanced
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PPTX
Computer Software - Technology and Livelihood Education
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
Time Tracking Features That Teams and Organizations Actually Need
PDF
Visual explanation of Dijkstra's Algorithm using Python
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
CCleaner 6.39.11548 Crack 2025 License Key
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Trending Python Topics for Data Visualization in 2025
Tech Workshop Escape Room Tech Workshop
How to Use SharePoint as an ISO-Compliant Document Management System
Computer Software and OS of computer science of grade 11.pptx
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Cost to Outsource Software Development in 2025
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
MCP Security Tutorial - Beginner to Advanced
DNT Brochure 2025 – ISV Solutions @ D365
Monitoring Stack: Grafana, Loki & Promtail
Computer Software - Technology and Livelihood Education
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
Advanced SystemCare Ultimate Crack + Portable (2025)
Time Tracking Features That Teams and Organizations Actually Need
Visual explanation of Dijkstra's Algorithm using Python
Salesforce Agentforce AI Implementation.pdf
CCleaner 6.39.11548 Crack 2025 License Key

C basics by haseeb khan

  • 1. What is C??  C is a programming language developed at AT & T’s Bell Laboratories of USA in 1972. It was designed and written by a man named Dennis Ritchie.  C seems so popular is because it is reliable, simple and easy to use. Getting Started with C: Communicating with a computer involves speaking the language the computer understands, which immediately rules out English as the language of communication with computer. However, there isa close analogy between learning English language and learning C language. Alphabets A, B, ….., Y, Z a, b, ……, y, z Digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Special symbols ~ ‘ ! @ # % ^ & * ( ) _ - + = | { } [ ] : ; " ' < > , . ? / Constants, Variables and Keywords: The alphabets, numbers and special symbols when properly combined form constants, variables and keywords. Let us see what are ‘constants’ and ‘variables’ in C. A constant is an entity that doesn’t change whereas a variable is an entity that may change. Types of C Constants C constants can be divided into two major categories:  Primary Constants Integer Constant Real Constant Character Constant  onstants Array Pointer Structure Union Enum, etc. Rules for Constructing Integer Constants: 1. An integer constant must have at least one digit. 2. It must not have a decimal point. 3. It can be either positive or negative. 4. If no sign precedes an integer constant it is assumed to be positive. 5. No commas or blanks are allowed within an integer constant. 6. The allowable range for integer constants is -32768 to 32767.
  • 2. Rules for Constructing Real Constants:  Real constants are often called Floating Point constants. The real constants could be written in two forms—Fractional form andExponential form.  Following rules must be observed while constructing real constants expressed in fractional form: 1. A real constant must have at least one digit. 2. It must have a decimal point. 3. It could be either positive or negative. 4. Default sign is positive. 5. No commas or blanks are allowed within a real constant. Rules for Constructing Character Constants:  A character constant is a single alphabet, a single digit or a single special symbol enclosed within single inverted commas. Both the inverted commas should point to the left. For example, ’A’ is a valid character constant whereas ‘A’ is not.  The maximum length of a character constant can be 1 character. Ex.: 'A' 'I' '5' '=' Types of C Variables  An entity that may vary during program execution is called a variable. Variable names are names given to locations in memory. These locations can contain integer, real or character constants. In any language, the types of variables that it can support depend on the types of constants that it can handle. This is because a particular type of variable can hold only the same type of constant. The rules for constructing different types of constants are different. However, for constructing variable names of all types the same set of rules apply. These rules are given below;-
  • 3. Rules for Constructing Variable Names 1. A variable name is any combination of 1 to 31 alphabets, digits or underscores. Some compilers allow variable names whose length could be up to 247 characters. Still, it would be safer to stick to the rule of 31 characters. Do not create unnecessarily long variable names as it adds to your typing effort. 2. The first character in the variable name must be an alphabet or underscore. 3. No commas or blanks are allowed within a variable name. 4. No special symbol other than an underscore (as in gross_sal) can be used in a variable name. These rules remain same for all the types of primary and secondary variables. C Keywords Keywords are the words whose meaning has already been explained to the C compiler (or in a broad sense to the computer). The keywords cannot be used as variable names because if we do so we are trying to assign a new meaning to the keyword, which is not allowed by the computer. Some C compilers allow you to construct variable names that exactly resemble the keywords. There are only 32 keywords available in C. 1. auto 2. double 3. int 4. struct 5. break 6. else 7. long 8. switch 9. case 10.enum 11.register 12.typedef 13.char 14.extern 15.return 16.union 17.const 18.float