C String Variable Type – POFTUT

C String Variable Type

[rps-include post=6557]

String is multiple characters added together. “Hi Poftut” is a string. Actually C do not direct String type but character type is used to store single and multiple characters.

Character

Character types is defined with char keyword. Single character will hold 1 byte in the memory. Character type normally hold ASCII characters but third party libraries provides support for different character types like UTF-8, UTF-16 etc.

char mychar=’a’;

String

As stated above string is a list of character types. We can define string like below.

Previous definition will create an char array which is equal to string. Above definition may seem a little bit error prone. We can define string more practical and less error prone like below.

[rps-include post=6557]

Leave a Reply

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

Enjoy this blog? Please spread the word :)