1.

Describe in detail about the unformatted console I/O functions.

Answer»

1. Single character functions: This function is used to read or print a character at a time, 

(i) getchar(): 

It reads a character from the keyboard and

tore it in a character variable. 

eg: 

char ch; 

ch=getchar(); 

(ii) putchar(): 

This function is used to print a character on the screen. 

eg: 

char ch; 

ch = getchar(); 

putchar(ch);

2. String functions: This function is used to read or print a string. 

(i) gets(): 

This function is used to read a string from the keyboard and store it in a character variable. 

eg: 

charstr[80]; 

gets(str);

(ii) puts(): 

This function is used to display a string on the screen. 

eg: 

char str[80]; 

gets(str); 

puts(str);



Discussion

No Comment Found

Related InterviewSolutions