Partially changed file structure to suit VSCode
This commit is contained in:
20
C7/Getchar/getchar_example.c
Normal file
20
C7/Getchar/getchar_example.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// declare variable
|
||||
char c;
|
||||
|
||||
printf("Input a character: ");
|
||||
// Wait for a kepypress, store result in c
|
||||
c = getchar();
|
||||
|
||||
// Display on the screen using printf
|
||||
printf ("The charcter pressed was %c\n", c);
|
||||
|
||||
// Display the charcter using putchar()
|
||||
putchar(c);
|
||||
|
||||
return 0; // Exit from main
|
||||
}
|
Reference in New Issue
Block a user