Week 2-Programming
Week 2-Programming
If you do not specify whether the variable is a signed variable or an unsigned variable, by default that is a signed variable and can accept
both positive and negative values.
long: This can be used to increased size of the current data type to 2 more bytes, which can be applied on int or double data types.
Data types in C Language
Data type determines the type of data a variable will hold. If a variable x is declared as int. it means x can hold only
integer values. Every variable which is used in the program must be declared as what data-type it is.
printf()
scanf()
Format Specifiers
Format Spectifiers in Programming language tells us which type of data to
store and which type of data to print or to output.
We can use the sizeof() operator to
check the size of a variable
Data Type Keyword Format Specifier
character char %c
signed integer int %d or %i
unsigned integer unsigned int %u or %lu
long double long double %ld
string char %s
floating point float %f
double floating point double %lf
Format String Meaning
float c;
Scanf (“%f”, & c) printf(“%f”, c)
double c;
printf(“float = %f \n", c );
String