Home / Programs / String in C Example
🚀 Programming Example

String in C Example

👁 1,010 Views
💻 Practical Program
📘 Step Learning
String in C Example

💻 Program Code

/* 
 
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;
}
                        

🖥 Program Output

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

📘 Explanation

String in C Example
📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.