Arrays
How do we compare the contents of two arrays of size 5??????
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jun 6, 2012, 1:40 PM
int[] array1 = {1, 2, 3, 4, 5};
int[] array2 = {1, 2, 3, 4, 5};
if (array1[0] == array2[0] && array1[1] == array2[1] && array1[2] == array2[2] &&
array1[3] == array2[3] && array1[4] == array2[4])
{
Console.WriteLine("The contents are the same");
}
else
{
Console.WriteLine("The contents are not the same");
}