In this C program, We will show “How to take input and print a string ” . So, let’s do it …
Print a String Without Taking User Input
//String is a character types Array.
#include<stdio.h>
int main()
{
char S1[30] = "New York";
printf(" City Name %s ", s1);
return 0;
}
Print a String Taking User Input
//String is a character types Array.
#include<stdio.h>
int main()
{
char s1[30];
printf("Enter your full name: ");
fgets(s1, 30, stdin);
printf("%s",s1);
return 0;
}
Keep Learning with PrologiCode.