Input/Output instruction in C
Input/Output instruction in C
|
Input/Output instruction in C Hello friends, today I will continue input/output instruction in c language. you saw how we can use 'printf' through this we can show our message on output screen. Now we learn how we can use printf in formatting the message so let's start
Let take an example
I want to print my name but the
last name is in the second line. So in the last class, we had understood that
first of all we have to use clrscr(); through this You can clear the screen .
So now I will write below and you will see it carefully and apply in Turbo, you
have also used any other software.
#include<stdio.h>
#include<conio.h>
void main();
{
clrscr();
printf("virender");
printf("sahu");
getch();
}
We see the work of ‘getch’ in
last part so please see last part. Link is given below
If we write code in such a way
that often-new people write, they make such a mistake. With this, my name will not come in the
next line, but stayed together.
But now see carefully this
coding
#include<stdio.h>
#include<conio.h>
void main();
{
clrscr();
printf("virender\n")
printf("sahu")
getch();
}
we can also write this in different way like
#include<stdio.h>
#include<conio.h>
void main();
{
clrscr();
printf("virender\nsahu")
getch();
}
What is \n ?
\n is a special symbol which is
used for new line.
What is Escape sequences?
Those symbols which come after back-link and perform different function.
For example:
\n
\t
\b
\\
\”
\r
Now if I have to bring my name
in the middle, how can I bring it? let’s see
#include<stdio.h>
#include<conio.h>
{
clrscr();
gotoxy(40,13);
printf("virender\n")
printf("sahu")
getch();
}
‘Gotoxy’ is a special symbol
which control the cursor. Through this you can bring cursor anywhere on the output
screen
Now in the next part we will see
how we can print a variable in the output screen.
I am trying
my best to explain the c language to you, please stay with me and share this
post and if there is any mistake then you comment on comment box
thanks for support
part 6 is here click on this link(https://grapsvs.blogspot.com/2020/04/Input-Output-instruction-in-C-part-6.html)
0 Comments
Please do not enter any spam link in the comment box and please follo me.