You can use the scanf function, and the corresponding header file is stdio.h
/* Example: take the input from keyboard in C language */ #include <stdio.h> #include <stdlib.h> int main(int argc, char const *argv[]) { char name[20]; int age; printf("Input a name : "); scanf("%[^\n]s",name); printf("Input the age: "); scanf("%d", &age); printf("The name is: %s\n", name); printf("The age is: %d\n", age); return 0; }Sourw:ecww.lautturi.com
output:
Input a name : lau tturi Input the age: 5 The name is: lau tturi The age is: 5