To be able to store more than one character you need to create and start an array with a predetermined size. (That’s for you, because it’s simple and you’re a beginner)
So before I give you the answer to your algorithm, you should study the following basic contents to develop in c language:
- Introduction to C Language
- Operators and Variables
- Function
- Basic I/O functions (input/output)
- Conditional Structures, Loops and Flow Control
- Blocks and Functions
- Inline instructions and the C compiler
- Vectors / Matrices
- String definition and manipulation
- String definition
- Pointers / Parameters by reference
- Operators and special types
Now.. Answering your question...
Your algorithm should look like this:
#include<stdio.h>
int main(){
char name[0];
int age;
printf("Entre com o seu Nome: ");
gets(name);
printf("Entre com a sua Idade: ");
scanf("%d", &age);
printf("\nNOME: %s\n", name);
printf("IDADE: %d\n", age);
return 0;
}
To level up your career as a developer, I suggest studying the topics mentioned and in your case as you are starting, below I leave a link where it contains from basic to advanced so you understand what I did and learn to c language:
DOCUMENTATION: LEARNING TO PROGRAM IN C
Good as you read and does nothing with what was read so the program just terminates normally. Also you set your name variable as a single character and not as a string you would expect for a name.
– anonimo