Which of the following correctly declare an array that can hold up to 3 rows of 5 columns of doubles? float array[3][5]; int array[3],[5]; int array[3][5]; float array[3,5];
Solución de tutoría real
Responder
Solución
¡Inicia sesión para desbloquear respuestas gratis!
Una plataforma de aprendizaje en la que confían millones de estudiantes y profesores reales.
Revisado y aprobado por el equipo de tutoría de UpStudy
The Deep Dive
The first option, `float array[3][5];`, is correct and clearly defines a 2D array that holds up to 3 rows and 5 columns of floating-point numbers (doubles). It’s a classic way to declare an array in C/C++ where both dimensions must be specified in square brackets. Now, let’s get real for a second! Picture a spreadsheet where you want to store a tidy table of data: 3 rows for category labels and 5 columns for their associated values. This array mistake is like trying to fit a round peg in a square hole—just doesn’t work! Always double-check your syntax when declaring arrays. Happy coding!