#include #include int main(){ char name[25]; //bytes int age; printf(" What's your name?"); //scanf("%s", &name); fgets(name, 25, stdin); name[strlen(name)-1] = '\0'; printf("How old are you?"); scanf("%d", &age); printf(" Hello %s, how are you?", name); printf(" You are %d years old", age); return 0; }
I have an issue where when i run the code, power shell will run in the terminal but I won't see the print line so "How old are you?", instead of seeing the line right away. a new cmd window will pop out and display "How old are you?", then I will have to type the age, then when I type the age, the new window closes and then the question "How old are you?" is written in the terminal. then I have to re-enter the age and then it shows the message You are 21 years old. How can I fix the new window popping out? I did go on code runner to checkmark for the terminal.
Hi bro. I've been watching Java tutorial from your series only.Please help me with the setup of Java in Visual Studio Code Also are you planning any series on android development ??
@@redemedy8602 no not at all. with int or char variables you use & to get their address aka get a pointer to them and change the value at which the pointer points. if you assign a pointer to a pointer with & you will only change the pointer (you will change where it points to) and that will cause an error
#include
#include
int main(){
char name[25]; //bytes
int age;
printf("
What's your name?");
//scanf("%s", &name);
fgets(name, 25, stdin);
name[strlen(name)-1] = '\0';
printf("How old are you?");
scanf("%d", &age);
printf("
Hello %s, how are you?", name);
printf("
You are %d years old", age);
return 0;
}
how about the birthdate?
How about this
#include
int main() {
char input1[100];
char input2[100];
printf("Input 2 (without space): ");
scanf("%s", input2);
printf("Input 2: %s
", input2);
// Clearing input buffer
while (getchar() != '
');
printf("Input 1 (with space): ");
scanf("%[^
]", input1);
printf("Input 1: %s
", input1);
return 0;
}
My friend using that code
This was a splendid lesson on user input in C. Thanks a ton.
i like that u mention the gap in knowledge at certain parts
Great production quality with your videos!
Nice lecture
Thanks for the tutorials bro!
Very simple and good.
noice, the string format also doesn't seem to advanced, great teaching bro
fgets(); Which autocomplete do you use for that?
Very useful, cheers mate.
amazing bro👍
Great
Thank You!!
ur the best :)
when i press run it direct to output and not terminal. how to run it??
I have an issue where when i run the code, power shell will run in the terminal but I won't see the print line so "How old are you?", instead of seeing the line right away. a new cmd window will pop out and display "How old are you?", then I will have to type the age, then when I type the age, the new window closes and then the question "How old are you?" is written in the terminal. then I have to re-enter the age and then it shows the message You are 21 years old. How can I fix the new window popping out? I did go on code runner to checkmark for the terminal.
How do you do, fellow kids!
DONE❤
❤❤❤❤
how can run in the black console like visual studio ??
cmd in windows
Bro❤️
🔥🔥❤❤DONE🔥🔥❤❤
❤
Hi bro. I've been watching Java tutorial from your series only.Please help me with the setup of Java in Visual Studio Code
Also are you planning any series on android development ??
legend
printf("Random comment1.2");
Why vscode? Why not dev-c++, vs19 or codelite?
more people are transitioning to vscode
lmao and here I am using notepad
Those are trash
can you not just do scanf ("%s%s", &nameF, nameL) instead of using fgets?
wazzup bro code!!! im new to the community!!!
am not 21 anymore but i pretend i still am!
he scanfs the string with an & and it works? how?
if you dont put it it will modify the pointer so...
@@redemedy8602 no not at all. with int or char variables you use & to get their address aka get a pointer to them and change the value at which the pointer points. if you assign a pointer to a pointer with & you will only change the pointer (you will change where it points to) and that will cause an error
It works because &array is equal to array in C, if he was using a pointer to a buffer allocated with malloc it would crash
I asked you a question that Which language is best for making mobile app than can control robots (Both iphone and android) ? Pls reply sir 🙏
yoooooooooooo
DO IT
oh my god c is not like java at all lol
early!
thx for noticing!
how can run input in mac os, because it isn't like your video.
:((
I asked you a question that Which language is best for making mobile app than can control robots (Both iphone and android) ? Pls reply sir 🙏
Python with Kivy framework could work