+ 2

Write a c program that allows you to enter and display your first name

6th Jan 2021, 9:08 AM
Joshua Mong
4 Respuestas
+ 3
int main( ) { char yourname; printf(“whats your name?\t"); scanf("%c",&yourname); getch(); return (0); }
6th Jan 2021, 9:22 AM
Joshua Mong
+ 3
Joshua Mong Char takes only one character. So you need to use pointer to take string input.
6th Jan 2021, 9:36 AM
A͢J
A͢J - avatar
+ 2
Can you show us your attempt? At which point do you get stuck?
6th Jan 2021, 9:10 AM
Lisa
Lisa - avatar
+ 2
char yourname[50]; // so you can input a name with max 50 letters then it needs to be %s And there seems to be a strange quotation mark in printf
6th Jan 2021, 9:44 AM
Lisa
Lisa - avatar