2.2 Hello, It’s Me
What to do
In a file called hello.c
, in a folder called me
, implement a program in C that prompts the user for their name and then says hello to that user. For instance, if the user’s name is Adele, your program should print hello, Adele\n
!
Advice
Hints * Recall that you can get a
string
from a user withget_string
, which is declared incs50.h
. * Recall that you can print astring
withprintf
, which is declared instdio.h
. * Recall that you can format astring
withprintf
with%s
.
Execute cd
by itself in your terminal window. You should find that your terminal window’s prompt resembles the below:
$
Next execute
mkdir me
to make a folder called me
in your codespace.
Then execute
cd me
to change directories into that folder. You should now see your terminal prompt as me/ $
. You can now execute
touch hello.c
to create a file called hello.c
in which you can write your code.
How to Submit
- Click and accept the Homework Link on the homework main page for this week.
- Complete each assignment for this week in the Github Codespaces environment.
- Save and click “Commit changes”.
- The autograder runs automatically; see the Actions tab for feedback.