Arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Arrays

Please tell me is there any difference between arrays in c and arrays in c#

20th Mar 2020, 5:38 PM
Nadeera manampery
Nadeera manampery - avatar
2 Answers
+ 1
Yes. In C# arrays are objects. In C there are no objects at all. In C there is no bound checking for arrays. C# throws exceptions if you try to access beyond array bounds. There is difference in syntax. Maybe some more differences. well, can you remove c++ from tags of this question? click 3 dots at top left corner and edit question.
20th Mar 2020, 6:15 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 1
They are different object types. Arrays belong to System.Array namespace whereas Arraylist belongs to System.Collection namespaces . Array is strongly typed . This means that an array can store only specific type of items\elements. As a result, it is type safe, and is also the most efficient, both in terms of memory and performance. While in arraylist, we can store all the datatype values. Array stores fixed number of elements. Size of an Array must be specified at the time of initialization . ArrayList grows automatically and you don't need to specify size.
25th Mar 2020, 6:06 PM
Danavv
Danavv - avatar