My Blog
Articles related to programming, computer science, technology and research.

22/04/2016 Categories: C Programming. No Comments on Input and Output in C

Reading Input from Keyboard

Another way of assigning values to variables besides directly assigning the value is reading values from the keyboard. C provides scanf function in the stdio.h header file. Using this function we can read values from the keyboard and assign the values to variables. The syntax of scanf function is as shown below:

scanf-syntax

The control string specifies the type of value to read from the keyboard and the ampersand symbol & is an operator to specify the address the variable(s). Example usage of scanf function is shown below:

scanf-example

 

Printing onto Screen

To print or output text onto the screen, we use printf function. Syntax of printf function is as shown below:

printf-syntax

Example usage of printf function is shown below:

printf-example1

Following are the format specifiers or control strings available in C:

format-specifiers

 

Suryateja Pericherla

Suryateja Pericherla

Hello, I am Suryateja Pericherla working as an Asst. Professor in CSE department at Vishnu Institute of Technology. I write articles to share my knowledge and make people knowledgeable regarding certain topics.
Suryateja Pericherla

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll Up
Thank you for visiting startertutorials.com! If you like this website do share with your friends by clicking on the social icons available on the left hand side.

As the domain name is quite large to remember, use this short domain to visit this site. Short domain: stuts.me