Tag Archives: C chars

C Chars & ascii

Characters are used to store literal values, like names of person , names of items etc..  Array of character is known as strings. Strings are terminated by null (‘’) character.

Single char variable takes 1 byte. so if we declare char array of 10 size it will take 10 bytes.

Declaration :

Above declaration will consume 1 byte of memory.

above declaration will consume 10 byte of memory

Initialization at the time of declaration:

Character arithmetic :

In c every characters has its ascii values.The below chart shows ascii value and character. There are 128 ascii values in C.

Functions supported by chars and strings :

Some function are listed below used to manipulate string and chars.

Function Name Description
getc() Used to input char from stdin
putc() Used to print char on  stdout (screen)
Gets() Used to input string from stdin
Puts() Used to print string on  stdout (screen)
Strcpy() Used to copy one string into other string variable
Strcat() Used to join two strings
Strchr() To find position of char in string
Strlen() To find length of string