how to store a user input with spaces in c
#include <stdio.h>
int main(){
char name[20];
printf("Enter a name : ");
scanf("%[^\n]%*c", &name);
printf("the name entered is: %s\n", name);
return 0;
}
how to store a user input with spaces in c
#include <stdio.h>
int main(){
char name[20];
printf("Enter a name : ");
scanf("%[^\n]%*c", &name);
printf("the name entered is: %s\n", name);
return 0;
}
input output string in c
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main()
{
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
char ch;
char s[100];
char p [100];
scanf("%c", &ch);
scanf("%s", s);
scanf("\n");
scanf("%[^\n]%*c", p);
printf("%c \n", ch);
printf("%s \n", s);
printf("%s", p);
return 0;
}
string input in c
#include <stdio.h>
int main () {
char str1[90], str2[90];
printf("Enter name: \n");
scanf("%s", &str1);
printf("Enter your website name: \n");
scanf("%s", &str2);
getting string input in c
#include<stdio.h>
#include<conio.h>
void main(){
chat sam[10];
clrscr();
printf("ENTER STRING NAME :");
gets(s);
printf("STRING :%s",s);
getch();
}
how to store a user input with spaces in c
#include <stdio.h>
int main(){
char name[20];
printf("Enter a name : ");
fgets(name, 20, stdin); // fgets(variable_storing_to, accepted_input_size, stdin)
printf("the name entered is: %s\n", name);
return 0;
how to get string input in c
#include <stdio.h>
int main () {
char str1[90], str2[90];
printf("Enter name: \n");
scanf("%s", str1);
printf("Enter your website name: \n");
scanf("%s", str2);
printf("Entered Name: %s\n", str1);
printf("Entered Website:%s\n", str2);
return(0);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us