C Programming Language Tutorial – Lecture 8 Input in C using scanf

This video explains input of various data types in C.

Our YouTube Channel


// Source Code:

// x - Integer & print
// y - Character & print
// z - string & print
//  scanf() - function to take user input defined in stdio.h header file


int main(){

int x;

printf("Enter value of x.\n");

scanf("%d",&x); //Input of int


char y;

printf("Enter the value of y.\n");

scanf(" %c",&y); //Input of char


char z[100];

printf("Enter a string:\n");

scanf("%s",z); //Input of string

printf("Entered String:%s",z);

return 0;

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s