In: Computer Science
Array
Arrays are non-primitive data type which is used to store a sequence or set of data on any particular primitive or non-primitive data type. It is generally used to store the collection of data. Arrays can store data in various dimensions or axis forming 2D,3D...nD arrays storing complex data according to the memory available and compiler.
arrays can be declared like array_name[i], where i is the size and the range is from 0 to i-1.
Various operations can be performed on arrays like splitting parts of the input, mathematical operations on input, sorting, etc.
String
String is also a non-primitive data type which is used to store sequence or set of data. But it has its advantages over arrays that a string is not constrained to any particular data type, it can store values of any data type in a single variable as input. This unique property is possible as it stores the ASCII value of the inserted character or number.
String also doesn't have any limit or size constrain while declaration, it could easily store any length of the input.
As string data type can store and return any data type within it is most widely used for any operation.