Hey everyone. This is my first day of learning C. So far I have just learned how to input numbers and have them multiplied/subtracted/divided/added. I've made a few tiny programs to help learn, but I've come across a problem. I want to make a program that will ask you for your name, you enter it, and then it just displays it again. Here is the code I would use:
When the program with that source runs, it says Please enter your name:. I input it then press enter but then it comes up and says Your name is 0. What is up with that? Does C even allow you to use text like that? Is there a certain code I have to use?Code:#include <stdio.h> int awesome_name; main() { printf("Please enter your name: "); scanf("%d", &awesome_name); printf("Your name is %d", awesome_name); return 0; }



LinkBack URL
About LinkBacks



nom legally.