Thursday, 2 April 2020

Sessions 2c Literals and Format Specifier in C


Literals in C

Values assigned to constant variables are known as literals.


There are 4 types of literals in C 
 
integer 
float
character
string
 
const int testint = 10;

Format Specifier in C

To print the value stored in a variable you use the format specifier operator.
This is used in the printf() function.



Format Specifier Description
%d

Integer

%f

float

%c

character

%s

string

%u

unsigned integer

%ld

long int

No comments:

Post a Comment