What will be the output of the following C code? 1. #include <stdio.h> 2. 3. { 4. 5. 6. 7. 8. 9. } void main() int a[2][3] = {1, 2, 3, 4, 5}; int i = 0, j = 0; for (i = 0; i < 2; i++) for (j = 0; j < 3; j++) printf("%d", a[i][j]); 123450 12345 junk 123455 Run time error
Added by Roy B.
Close
Step 1
The rest of the elements in the array are not initialized explicitly, so they will be automatically initialized to 0 by the compiler. The nested for loop then prints out each element in the array. Show more…
Show all steps
Your feedback will help us improve your experience
Khoobchandra Agrawal and 73 other Physics 101 Mechanics educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
What will be the output of the following statements? int i = 1, j; j = i-- - -2; printf("%d", j);
Madhur L.
a = 5 b = 5 c = ((a**2) + (b**3)) / (a*b) print(c) What is the output of the above program?
Sanchit J.
What is the output of the following code? [10] int x; int *p; int *q; p = new int[10]; q = p; *p = 4; for (int j = 0; j < 10; j++) { x = *p; p++; *p = x + j; } for (int k = 0; k < 10; k++) { cout << *q << " "; q++; } cout << endl
Ravindra Y.
Recommended Textbooks
University Physics with Modern Physics
Physics: Principles with Applications
Fundamentals of Physics
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD