Read and Write Character in C

Advertisements

Prev Tutorial Next Tutorial

Read and Write Character in C

We can read and write a character on screen using printf() and scanf() function but this is not applicable in all situations. In C programming language some function are available which is directly read a character or number of character from keyboard.

getchar

This is a predefined function in C language which is available in stdio.h header file. Using this function we can read a single character from keyboard and store in character variable. When we want to read a number of character form keyboard the store all the data in a character array.

Example

char ch;
ch=getch();

Note: getchar function has no any parameters.

gets

This is a predefined function in C language which is available in stdio.h header file. This function is used to read a single string from keyboard.

Example

gets(string);

putchar

putchar function is a same as getchar but is function is used for display a character value of screen or console. This function must be take one parameters.

Example

char ch='A';
putchar (ch);

putchar is equivalent to printf("%c",ch);

puts

puts is same as gets function but this is used to display a string on screen or console. This function takes single arguments.

Example

puts(str);

Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements