New course! Every coder should learn Generative AI!
Try a free lesson+ 6
Strings and arrays are quite similar except the length of an array is fixed whereas strings can have a variable number of elements. Technically, arrays are a special type of variable that can hold more than one value at a time. They are a sequential collection of elements of similar data types, whereas strings are a sequence of characters used to represent text rather than numbers. In addition, strings are immutable which means the value of an object cannot be modified once it’s created, while arrays are mutable meaning the fields can be modified. Simply put, an array is a collection of like-type variables whereas a string is a sequence of characters represented by a single data type.
+ 12
A character array is just a character array, while a string is a class which contains a character array, and has built-in methods to help you manage that character array. You may choose to allocate memory for a character array on the stack or the heap, while strings are automatically managed for you.
https://stackoverflow.com/questions/1287306/difference-between-string-and-char-types-in-c
+ 7
Here in 2019 Strings can also be objects, and coded in memory in a few different ways. The main difference is how they are supposed to be used. Stings are meant to store text, like tweets, or passages in a book, or comments, . For a deep dive, you might look up the topics: EBCDIC, ASCII, and UTF-8. Strings have expanded in capability over the years as support for more languages, math, and technical symbols. 64 bit memory devices, can store a ridiculous amount of codes in one memory location, and each code can represent a character. What character? That is really up to the engineers, but they decide these issues at intertnational conventions.
+ 6
String is data, Array is datastructure.
+ 5
Depends on the language, too.
In C, a string is an array of chars that ends with '\0' (the signal sign to stop reading).
And if that termination symbol is missing, it's just a char array.
+ 5
This is sometimes language dependent.
+ 4
array = [3, "s", true, "hello"]
string = "Hello its just a String..."
print(array[2]) #true
print(array[1]) # s
print(array) #[3, "s",...]
print(string[1]) # e
print(string) #Hello its just a string
+ 4
Of course you can have an array of strings, or even a two dimensional array of strings.
+ 3
I am learning a lot from reading the discussion on here.
+ 2
Strings are similar to arrays with just a few differences. Usually, the array size is fixed, while strings can have a variable number of elements. Arrayscan contain any data type (char short int even other arrays) while strings are usually ASCII characters terminatedwith a NULL (0) character.
+ 2
A string can be considered as a variable or value whereas an array contains many values. A string does not have a fixed length but an array can be any data type with a fixed length. Usually in coding, strings are indicated by apostrophe symbol("string") while array does not have apostrophe
+ 2
To declare an array you must know the data type of the items that you are going to put into the array. Each item must be of the same type. Then pick a nice descriptive name for your array, and decide how many items it will need to store, at MOST....
+ 2
Let's say that you want to store a season's worth of baseball scores for the favorite team, the Peeps. You know that they will play 24 games. You know that scores never have a fractional part. So, an integer data type is the best for this array. You chose the name: peep2019scores. With all of this ready you would declare you array like this:. int[] peep2019scores = new int[24];. The square brackets are the critical part that makes this an array and not just a single integer variable.
+ 1
Recently I learn c++ so I have no much more idea about its features and I really want to know what is the difference between string array, I also tried to declare array but it shows an error dell error code 2000-0333, so I really want a solution how to declare an array in c++.
+ 1
Recently I learn c++ so I have no much more idea about its features and I really want to know what is the difference between string array, I also tried to declare array but it shows an error https://errorcode0x.com/solved-dell-error-code-2000-0333/, so I really want a solution how to declare an array in c++.
+ 1
A string contains characters while arrays can contain different data types and more number of data types.
0
Bhai dekh string is a collection of words and array is a data of similar type which are calling by common name