getch(), gotoxy(), clrscr(), Excape Sequences, Format Specifier and Sample program in C Language

getch(), gotoxy(), clrscr(), Excape Sequences, Format Specifier and Sample program in C 


getch()


getch() reads a single byte character from input. getch() is a way to hold program execution(hold the output screen), but holding is simply a side-effect of its primary purpose, which is to wait until the user enters a character.

gotoxy in C 


gotoxy function places cursor at a desired location on screen i.e. we can change cursor position using gotoxy function.

Declartion : void gotoxy( int x, int y);

where (x,y) is the position where we want to place the cursor.

Clrscr function in C


Clrscr function clears the screen and move the cursor to upper left hand corner of screen.

Escape Sequences


It is used to enter a newline, tab, question mark etc in C programming.

Escape Sequences
Escape Sequences
Character
\b
Backspace
\f
Form feed
\n
Newline
\r
Return
\t
Horizontal tab
\v
Vertical tab
\\
Backslash
\'
Single quotation mark
\"
Double quotation mark
\?
Question mark
\0
Null character

Format Specifiers



%c char single character

%d (%i) int signed integer

%e (%E) float or double exponential format

%f float or double signed decimal

%g (%G) float or double use %f or %e as required

%o int unsigned octal value

%p pointer address stored in pointer

%s array of char sequence of characters

%u int unsigned decimal

%x (%X) int unsigned hex value


Sample Program








Please like and share.....

Comments

Popular posts from this blog

Important Announcements(download all my book free)

O LEVEL- INTERNET TECHNOLOGY & WEB DESIGN

Call by Reference with Pointer in C Language part-4-a