String in C Example

C Programming Language / String in C Language

915

Program:

/* 
 
Author: Atnyla Developer

*/

#include<stdio.h>
 
int main ()
{
  char string1[11] = {'h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd', '\0'};
   char string2[11] = "helloworld";
   char string3 []  = "helloworld"; 
 
   printf("The string is : %s \n", string1 );
   printf("The string is : %s \n", string2 );
   printf("The string is : %s \n", string3 );
   return 0;
}

Output:

The string is : helloworld
The string is : helloworld
The string is : helloworld
Press any key to continue . . .

Explanation:

String in C Example

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.