Monday, 7 November 2016

Session 2 : Briefing

Session Two :
Data Types
Integer ( Decimal, Octal, Hexademimal ) {Signed , Unsigned}
Floating
Double
Character
Range of the data types depends on machine. So, we have written a program to find the range which is shared at later stage.
Examples for different data types are discussed in class.
Variables :
How to define a variable?
datatype v1,v2,v3..;
Initialisation :
datatype variable_name = data;
Here, variable name is an alias to backend memory, data is stored in that memory location.
Formatted input output functions /*Unformatted functions are dealt in previous class */
Unformatted i/o function:
getchar() : Reads character from keyboard , waits for user to type character and then enter keyboard
getch() : Reads a character from keyboard and doesnt wait for enter key.
getche() : Reads a character from keyboard and doesnot wait for user to type enter key. Character enter will be echoed.
gets() : Reads a string from keyboard and waits for user to type ENTER key.
putchar() / putch() : To echo character on screen
puts() : Echos string on screen.
Formatted function:
Data Types with Format specifier.
int :
%d --> Data into decimal signed integer
%u --> Data into decimal unsigned integer
%o --> Data into octal integer
%x / %X --> Data into Hexademimal integer
%h --> Data into short integer

float :
%f --> Data into floating point value
%e / %E --> Data into floating point exponential value
double :
%lf / %Lf : Data into LONG floating point value
char :
%c --> Converts data into character
%s --> Converts data into string

No comments:

Post a Comment