How to read character array in c using for loop
- how to read character array in c
- how to read character array in c using for loop
- how to read character array in c using scanf
- how to read and print character array in c
Character array and string in c...
What is the difference between string and character array in c
What is Character Array in C?
- A Character array is a derived data type in C that is used to store a collection of characters or strings.
- A char data type takes 1 byte of memory, so a character array has the memory of the number of elements in the array.
(1* number_of_elements_in_array).
- Each character in a character array has an index that shows the position of the character in the string.
- The first character will be indexed 0 and the successive characters are indexed 1,2,3 etc...
- The null character \0 is used to find the end of characters in the array and is always stored in the index after the last character or in the last index.
Consider a string "character", it is indexed as the following image in a character array.
Syntax
There are many syntaxes for creating a character array in c.
The most basic syntax is,
- The name depicts the name of the character array and size is the length of the character array.
- The size can be greater than the length of the string but can not be lesser.
If it is lesser then the full string can't be stored and if it is
- character array in c example
- what is character array in c