Definition :
A string is a sequence of characters stored in an array of characters terminated by a null character ('\0').
Syntax:
char string_name[size];
Declaration and initialization of a String
char str[50] = "Hello, World!";
Example program to read and print string
#include <stdio.h>
int main()
{
char name[20];
printf("Enter name: ");
gets(name);
printf("Your name is %s.", name);
return 0;
}
String Functions:
C provides several built-in functions in the string.h library to perform operations on strings. Some commonly used functions include: