Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary Programming in C

Rating
-
Sold
-
Pages
11
Uploaded on
24-08-2025
Written in
2024/2025

It is an pdf containing summary notes of topic "Array and Pointers in C programming" with summarized theory, practice question and previous year questions of GATE exam.

Institution
Course

Content preview

Chapter 1
Programming in C

LEARNING OBJECTIVES

• Basic concepts • Precedence decreases as we move from top to bottom
• Character set • Type conversion
• Identifier • Documentation section
• Declaring a variable • Preprocessing
• Visualization of declaration • Global declaration
• Constants • Control statements
• Single character constants • Selection/Decision making statement
• String constants • Looping statements
• Using const keyword • Unconditional jump statements




BasiC COnCepts Variable
The name itself represents value, is not constant. Variable is a
Character Set data name whose value varies/changes during program execution.
Variable name is a name given to memory cell (may be one or
A character refers to an alphabet, digit or a special symbol. multiple bytes).
Alphabets: A – Z, a – z
Digits: 0 -9
Special symbols:
Data types
∼ ! # % ∧ and * ( ) - + { } [ ] - < > , . | ? \ | : ; ” ’ White space Represents type of data and set of operations to perform on data .
Data Type
Identifier Primitive/Basic Derived User defined Valueless
Identifier is a user-defined name used for naming a variable or a – Char – Array – Structure
function. – float – pointer – union – void
Rules for naming an identifier
– double Enumeration
• Consists only letters, digits and underscore – integer
• Starts only with an alphabet or underscore
• Keywords cannot be used.
Type Keyword Number of Bytes
• Can be as long as you like, first 31 characters are significant.
Integer int 2

Example: Valid identifiers: RollNo, Roll_No, _Roll_No Floating float 4
rollno, Name2; Double double 8
Invalid: 2name, Roll No. Character char 1

, 3.4 | Unit 3 • Programming and Data Structures

Declaring a Variable Constants
A constant value is one which does not change during the
•• Before using a variable, you must give some information
execution of a program.
to compiler about the variable. i.e., you must declare it.
C supports several types of constants:
•• Declaration statement includes the type and variable
name. 1. Integer constants
2. Real constants
Syntax:
3. Single character constants
Datatype Var_name;
4. Strings constants
Example:
int roll_no;
char ch; Integer constants
float age;
An integer constant is a sequence of digits. It consists of
•• When we declare a variable a set of digits 0 to 9 preceded by an optional + or - sign
•• memory space is allocated to hold a value of specified spaces, commas, and non-digit characters are not permitted
type. between digits.
•• space is associated with variable name Examples for valid decimal integer constants are
•• space is associated with a unique Address. 123
-31
Table 1 Visualization of declaration 0
roll no 562321
int roll no; garbage
+78
Examples for invalid integer constants are
2002
20,000
marks `1000
int marks = 10; 10
3008 Real constants
diameter Real constants consist of a fractional part in their represen-
float diameter = 5.9 5.9 tation. Integer constants are inadequate to represent quanti-
4252 ties that vary continuously.
ch → variable name Examples of real constants are
char ch : ‘A’ A → value
0.0026
-0.97
2820 → address
435.29
Note: The default value is garbage, i.e., an unknown value +487.0
is assigned randomly.
Renaming data types with typedef Typedef is a keyword,
Single character constants
which can form complex types from the basic type, and will A single character constant represents a single character
assign some simpler names for such combinations. This is which is enclosed in a pair of quotation symbols.
more helpful when some declaration is very tough, confus- Examples for character constants are
ing or varies from one implementation to another. ‘5’
For example, the data type unsigned long int is redefined ‘x’
as LONG as follows: ‘;’
typedef unsigned long int LONG;
String constants
Uses of enumerated data types Enumerated data types are
A string constant is a set of characters enclosed in dou-
most useful when one is working over small, discrete set
ble quotation marks. The characters in a string constant
of values, in which each is having a meaning and it is not
sequence may be alphabet, number, special character and
a number.
blank space.
A best example can be given on months jan, feb, mar, …,
dec, which are 12 in number, with assigning consecutive num- Examples of string constants are
bers for it. “VISHAL”
The main advantages are storage efficiency, the c-code “1234”
can become readable “C language”
“!….?”

Written for

Course

Document information

Uploaded on
August 24, 2025
Number of pages
11
Written in
2024/2025
Type
SUMMARY

Subjects

$4.89
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
yogendra

Get to know the seller

Seller avatar
yogendra Poornima University
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
8 months
Number of followers
0
Documents
2
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions