What is the difference between string & character array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

What is the difference between string & character array?

30th Jun 2020, 3:44 PM
INDRAJIT BANERJEE
INDRAJIT BANERJEE - avatar
8 Answers
+ 5
The difference between character array & string is ,the string ended with a '\0' but incase of character array there are no null point is available. String is a type of character array.
30th Jun 2020, 3:50 PM
Sourashis Paul
Sourashis Paul - avatar
+ 3
In C language, a string is an array of char, these terms all refer to the same thing. In C++ however, a string is a template class instance. Although internally C++ string uses char array as buffer, C++ string is not a mere char array. Hth, cmiiw
30th Jun 2020, 3:48 PM
Ipang
+ 3
String is define as array of characters and end with null.
1st Jul 2020, 5:45 AM
Aarti Rani
Aarti Rani - avatar
+ 3
Char holds a single character, while strings holds lots of characters and ends with '\0'
1st Jul 2020, 4:02 PM
Bhavana
+ 3
INDRAJIT BANERJEE if u goes deeply string is nothing it's a sequence of character when u talk about string mean u have some character then we stored in our mind like hello name e.t.c but string in computer we store group of some character who's termination is \0(null character) .but what does mean character array character array simply a array of char data type .u can store individual character if u want to store string it behave like a string and if u want indivisual store character u can store but in string data type u can store a particular string I hope u get it.
10th Jul 2020, 1:03 PM
Noman
Noman - avatar
+ 2
String array example, String[ ] text = {"Indrajit Bannerjee", "Arya deep"}; Basically, String data type can be reffer as words. This was an example of string array. Character array example, Char[ ] word = {'I', 'B', 'A'}; Basically, Charcter data type can be reffer as letters. This was an example of charcter array. I hope this helps......!☺☺
1st Jul 2020, 1:18 PM
Arya Deep Chowdhury
Arya Deep Chowdhury - avatar
0
what is difference between character array and string in c
7th Mar 2024, 1:54 PM
abhishek kumar singh
abhishek kumar singh - avatar
- 3
The obvious difference is that char array is mutable unlike string, so you can change characters in char array, unlike for list.
30th Jun 2020, 3:47 PM
Seb TheS
Seb TheS - avatar