Easy learning with example program codes

String in C

C Strings:

A sequence of characters, internally stored in the form of an array of characters is called as string.

Declaration of String:

In C, a string can be specified in two ways:

Character Array:

A string declared as an array, where each character represents an element of that array, is called as Character Array.


char array_Name[] = {char1,char2,char3………};

String Literal:

A string declared as an array, where the whole string represents a complete array, is called as String Literal.


char array_Name[] = “stringValue”

Example :

#include <string.h>  
void main()
char chr[]={'H', 'E', 'L', 'L', 'O', ' ', 'C', '\0'};    
char str[]="HELLO C";    
printf("String in form of character array: %s\n", chr);    
printf("String in form of string literal: %s\n", str);    


String in form of character array: HELLO C
String in form of string literal: HELLO C
Posted in C   

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki