Declaration of Strings in C

A string in C is simply a sequence of characters.

Declaration of Strings in C

To declare a string, specify the data type as char and place the number of characters in the array in square brackets after the string name.

The syntax is shown below:

char string-name[size];

For example,

char name[20];

char address[25];

char city[15];

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
?>