User input using Gets and Puts in C programming is used to take input from the user and print the value. Gets are used to take input from the user, and Puts are used to print the value.
#include<stdio.h>
#include<conio.h>
void main()
{
char c[] = "HiLaLs Afridi"; //assigning value to array.
printf("%s", c); //and printing.
getch();
}
//U also write like 'char c[13] = "HiLaLs Afridi";'.
#include<stdio.h>
#include<conio.h>
void main()
{
char name[] = "HiLaLs Afridi"; //assigning name to 'name' Array.
int i = 0;
while(name[i] != '\0') //loop looping if Array Not equal to 0.
{
printf("%c", name[i]); //and printing Elements of 'name' Array.
i++;
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
char c[10]; //this is array.
printf("Please Enter Ur Name: ");
scanf("%s", &c); //user enter value storing in 'c' array.
printf("Ur Name is: ");
printf("%s", c); //and printing.
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
char c[20]; //this is array.
puts("Please Enter Ur Full Name: ");
gets(c); //user enter value storing in 'c' array.
puts("Ur Name is: ");
puts(c); //and printing.
getch();
}