What is deffent between interger and array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is deffent between interger and array?

In c programing

13th Jun 2019, 9:17 AM
Mohsin Ali
Mohsin Ali - avatar
3 Answers
+ 3
An integer is a single numerical value without decimal places, like 5, 2314 or -894. An array is a collection of several values of the same type. For example an array of three integers might look like this: int arr[] = {5, 2314, -894}; Instead of a defining multiple variables like this: int var1 = 5; int var2 = 2314; int var3 = -894; it's usually easier and more efficient to create an array, especially if you need dozens, hundreds or thousands of variables of the same type.
13th Jun 2019, 9:46 AM
Anna
Anna - avatar
+ 2
I'm probably guessing you want the difference between them. An integer is a primitive datatype, but an array isn't. An array can hold any kind of datatype, for example int, char... An integer can only store whole numbers
13th Jun 2019, 9:40 AM
Airree
Airree - avatar
0
Oh thanks
13th Jun 2019, 11:16 AM
Mohsin Ali
Mohsin Ali - avatar