Learn how to enter user input in C! ⌨️ @BroCodez
Learn how to enter user input in C! ⌨️  @BroCodez
Uploaded February 2025 | Updated September 2026, 1 week ago
#coding #programming #cprogramming

00:00:00 VSCode setup
00:01:55 declaring variables
00:02:57 undefined behavior
00:06:31 scanf
00:09:47 input buffer
00:10:47 scanf w/ strings
00:12:16 fgets
00:13:20 getchar()
00:14:05 removing \n from a string

int age = 0;
float gpa = 0.0f;
char grade = '\0';
char name[50] = "";

printf("Enter your age: ");
scanf("%d", &age);

printf("Enter your gpa: ");
scanf("%f", &gpa);

printf("Enter your grade: ");
scanf(" %c", &grade); // The space before %c is necessary to consume any leftover \n.

getchar(); // clears \n from input buffer
printf("Enter your full name: ");
fgets(name, sizeof(name), stdin);
name[strlen(name) - 1] = '\0'; //changes last char from \n to \0

printf("%s\n", name);
printf("%d\n", age);
printf("%.2f\n", gpa);
printf("%c\n", grade);

return 0;
Learn how to enter user input in C! ⌨️Code a C digital clock in 10 minutes! ⌚Code a dice roller program with Java! 🎲Learn hexadecimal in 0x79 seconds #coding #computerscience #programmingLearn enums in 8 minutes! 📅Learn Java nested loops in 8 minutes! ➿Matplotlib labels in 6 minutes! 🏷️Learn the Java ternary operator in 5 minutes! ❔Learn Java multithreading in 8 minutes! 🧶Learn binary in 01000000 seconds #coding #computerscience #programmingLets code an interest calculator with C programming! 💰Learn EXCEPTION HANDLING in 8 minutes! ⚠️
Bro Code |

Learn how to enter user input in C! ⌨️

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER