This shows you the differences between two versions of the page.
— |
c:stdio.h:putchar [2024/02/16 01:05] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{keywords>wiki library source code example reference}} | ||
+ | |||
+ | ===== putchar ===== | ||
+ | <code c> | ||
+ | int putchar(int char); | ||
+ | </code> | ||
+ | |||
+ | put a character into stdout | ||
+ | |||
+ | ===== C Sourcecode Example ===== | ||
+ | <code c> | ||
+ | /* | ||
+ | * putchar example code | ||
+ | * http://code-reference.com/c/stdio.h/putchar | ||
+ | */ | ||
+ | |||
+ | #include <stdio.h> /* including standard library */ | ||
+ | //#include <windows.h> /* uncomment this for Windows */ | ||
+ | |||
+ | |||
+ | int main( void ) | ||
+ | { | ||
+ | int c; | ||
+ | c = 0; // ASCII Code a | ||
+ | |||
+ | while (c < 255) { // count chars in a while loop | ||
+ | putchar(c); | ||
+ | c++; | ||
+ | } | ||
+ | |||
+ | putchar('\n'); | ||
+ | return 0; | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | output complete ASCII Table | ||
+ | ==== Output ==== | ||
+ | ./putchar | ||
+ | |||
+ | |||
+ | |||
+ | 123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~???????????????????????????????????????????????????????????????????????????????????????????????? | ||