C putc() function

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Putc : Write Single Character to specified Stream 

Syntax :

int putc( int ch, FILE *stream );

What it does ?

  1. It Writes Character onto the Stream.
  2. Its Return Value is Character Written on Stream.
  3. If any Error Occures then It returns EOF

Live Example :


int main(void)
char msg[] = "Hellon";
int i = 0;

while (msg[i])
putc(msg[i++], stdout);
return 0;

Output :
       Writes “Hello” Word to File Character by Character
Diagram :