STRING IN C

Seema Roselin


String in c programming

STRING IN C

String is a sequence of character which is enclosed between double quotes.In C, a string  is terminated with a NULL character '\0'. 

Syntax:

char string_name[length];

Here string_name is the name of the string and length is the maximum number of characters that can be stored in the string.

For example:

char str[20];
char str[] = "welcome";

Program:

#include <stdio.h>
int main() 
{
char str[] = "My welcome";
printf("The string is: %s\n", str);
return 0;
}

Output:


The string is: My welcome



Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send