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
Class notes

C Coding College Mastery

Rating
-
Sold
-
Pages
6
Uploaded on
31-07-2023
Written in
2022/2023

This Document will help you doing mastery in C coding language at College Coding level as well as Competitive coding level also. These Docs will help in better grasping of the knowledge and its applications in real world.

Institution
Course

Content preview

Second Semester 2022-23
Computer Programming (CS F111)
LAB - 2
Topics to be covered: Keywords, Primary Data Types, Constants, Variables, Basic Arithmetic
Expressions, Number system

Lab notes
Keywords
Keywords are the reserved words. They have fixed meanings and these meanings cannot be
changed. They must be written in lowercase.
auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while
Primary Data Types
Type Min size (in bits) Format Specifier
char 8 %c
signed char 8 %c
unsigned char 8 %c
short int 16 %hd (decimal), %ho (octal), %hx (hex)
signed short int 16 %hd (decimal), %ho (octal), %hx (hex)
unsigned short int 16 %hu (decimal), %ho (octal), %hx (hex)
int 16 %d (decimal), %o (octal), %x (hex)
signed int 16 %d (decimal), %o (octal), %x (hex)
unsigned int 16 %u (decimal), %o (octal), %x (hex)
long/long int 32 %ld (decimal), %lo (octal), %lx (hex)
signed long int 32 %ld (decimal), %lo (octal), %lx (hex)
unsigned long int 32 %lu (decimal), %lo (octal), %lx (hex)
float 32 %f or %g or %e or %a
double 64 %f or %g or %e or %a
long double 128 %Lf or %Lg or %Le or %La




1

, Constants
The constants refer to fixed values that the program may not alter during its execution. These
fixed values are also called literals.

Integer
constants
Numeric
constants
Real constants
Constants
Single
character
Character constants
constants
String
constants

• Integer constants: There are three types of integers: decimal, octal, and hexadecimal.
- Decimal integers consist of a set of digits, 0-9, preceded by unary + or -.
Ex: 100, -101, +102
- Octal integers are always preceded by 0. It consists of a combination of digits 0-7.
Ex: 0144, -0145, 0146
- Hexadecimal integers are preceded by 0x or 0X. It consists of a combination of
digits 0-9 and A to F or a to f.
Ex: 0x64, -0X65, 0X66
- Unsigned integers, unsigned long integers, and long integers can be expressed with
suffix u, ul, l or U, UL, L respectively.
Ex: 2022u or 2022U, 2022ul or 2022UL, 2022l or 2022L
• Real constants: Real constants are having a whole number followed by a decimal point
and fractional part. It is possible to omit digits before or after decimal point.
Ex: 2.022, -20.22, .22, -20.
A real constant can be expressed in exponential notation.
Ex: 20.22e2, 2.022E3, 20220e-1
• Single character constants: A single character constant contains a single character
enclosed within a pair of single quote marks.
Ex- '2', 'A', 'a', ';'
• String constants: A string constant is a sequence of characters enclosed in double
quotes. The characters may be letters, numbers, special characters, and blank space.
Ex- "Hello!!!", "2022", "Hello 2022!", "5+5"




2

Written for

Institution
Course

Document information

Uploaded on
July 31, 2023
Number of pages
6
Written in
2022/2023
Type
Class notes
Professor(s)
Apurba das
Contains
All classes

Subjects

$8.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
topperbro69

Get to know the seller

Seller avatar
topperbro69 NYC
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
1
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