Recent Posts

Saturday, 8 December 2018

Program to get 1 string input and print it.

String:

String is a collection of two or more characters.
In the previous post we learn about what is string.and How it can be print.

Program to get one string input and print it.

#include<stdio.h>
#include<conio.h>
void main()
{
char text[50];
clrscr();
printf("type string");
scanf("%s",&text);
printf("string is = %s",text);
getch();
}


Explanation:

1. Void main():
This is the first statement of every 'C' program,without main() function 'C' program cannot be start.If we didn't include main() function in 'C' program then error will be occurred.so every 'C' program must start with main() function.

2.char:
Char is a data type which is used for print the string.

3.Clrscr();
This is the clrscr() function.This function is used to clear the screen.This function is used to clear the output of the previous output window.

4.Printf():
Printf is a function which used to print any text or value on the screen.The text you want to print is enclosed in  double quote.you can see the below example:
                                   printf ("Hello world");
in the above example hello world will be printed.

5.getch();
This function is used to hold the output window.otherwise when you run your code it will display the output window just for a second so it is necessary to use it in our program.If we want to hold our  output screen.




Related Posts:

  • Palindrome number in C Here we will see what is palindrome number and how to write a program for palindrome number. Palindrome number in C: A palindrome number that re… Read More
  • C Program to swap two numbers In the previous post we learnt about Program for addition of two numbers.In this post we learnt about  How to get two numbers and swap it #inc… Read More
  • Structure of C Program In the previous tutorial we learnt Rules for writing a 'C' Program.In this tutorial we will learn the Structure of C Program.The C program i… Read More
  • Hello world in C In the previous post we learnt How to write 'C' program and Structure of 'C' program.In this post we will learn how to print Hello worl… Read More
  • addtion program in C In the previous tutorial we learn about simple program How to write Hello world in 'C'.and in this post we will learn how to sum two numbers in c p… Read More

0 comments:

Post a Comment

Followers

Popular Posts

Categories

social media

Text Widget

Powered by Blogger.

About Me

My name is junaid khan and i am a full time blogger and author of a blog tutorial called tutorialpointsolution.

String function

In the previous post we learn about what is String .we know that string is a collection of two or more characters.In string we can store al...

Search This Blog

Technology

Adbox

Recent Post

Breaking

Recent In Internet

Comments

Facebook

Pages

Comments

Pages

Recent

Pages

Technology