Arrays
How do we compare the contents of two arrays of size 5??????
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Jun 6, 2012, 9:40 AM EDT
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");
}