What is the difference between a Dynamic 2D Array in C (int **arr) and A 2D Array in Java (int [][]arr) ?
Is a 2D Array in C/C++ similar to a 2D Array in Java?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The answer will change according to part you want to compare.
In Java, arrays are objects that have methods and attributes, however in C/C++ they are not objects.
Both of them similar in a way that array dimension can be different. I mean arr[0] can be 3-dimensional, arr[1] 5-dimensional, etc.
Java is checking array bounds therefore will throw exceptions if you try to reach an index outside of the array boundaries, however in C/C++ no exception will be thrown however, you might end up with an “segmentation fault”.