Quote:
How do I make this code look and work better?
Your code does nothing but spitting a little text, the only improvement is presentation.
Advice: Learn to indent properly your code, it show its structure and it helps reading and understanding. It also helps spotting structures mistakes.
#include <stdio.h>
int main() {
int life;
int up;
char chr;
int n;
printf("Welcome to snake.\n");
printf("Hi, this is a game snake. The snake game is a simple game, basically, you have to move around, and eat food, without hitting yourself or the walls. Every time you eat, the snake grows bigger, making it harder.\n");
printf("Before we start, How many lifes do you want?");
printf("Enter a number:/t");
scanf("%c",&chr);
printf("You chose %c ", chr);
printf("lives.\n");
printf("You have %c", chr);
printf("Lives\n");
if (char == null;)
{
printf("That is not a number\n");
}
return 0;
}
Indentation style - Wikipedia[
^]
Professional programmer's editors have this feature and others ones such as parenthesis matching and syntax highlighting.
Notepad++ Home[
^]
ultraedit[
^]
Enabling Open Innovation & Collaboration | The Eclipse Foundation[
^]