Skip to content
Home » C Programs » C Program to Print String Using Array

C Program to Print String Using Array

Simple c program to print a string. The printf function returns the value of the argument it was supplied. Then, if it’s saved in a character array, we’ll see how to print it. The characters in the element will be printed in the output.

Char in C Program to Print a String

To store characters and letters, C employs the char type. However, the char type is an integer type because C stores integer numbers rather than characters. Char values in C are stored in 1 byte of memory and have a value range of -128 to 127 or 0 to 255. 

Character data is stored in a fixed-length field by the char data type. Data can be a string of single-byte or multibyte letters, numbers, and other characters supported by your database locale’s code set. A char column’s size is byte-based, not character-based. Here we have successfully executed this c program to print a string

Printf Statement in C

The printf format string is a control parameter used by a class of functions in C and many other programming languages’ input/output libraries. “printf” stands for “print formatted” and is the name of one of the main C output functions.

Array in C Program

An array is defined as a collection of data items of the same type that are stored in contiguous memory locations. Arrays are derived data types in the C programming language that can store primitive data types such as int, char, double, float, and so on. An array is a collection of similar data types.

C Program to Print a String

//c program to print a string
#include <stdio.h>
int main()
char a[1000] = "Welcome to";
printf("%s", a);
return 0;

Output of c program to print a string:

Welcome to