#include <iostream> using namespace std; int main() { int points_a[3] = {1, 2, 3}; int points_b[3] = {4, 5, 6}; int points_c[3] = {7, 8, 9}; // Good Practice int points[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; cout << points[1][2]; // 6 cout << points[2][0]; // 7 cout << points[2][2]; // 9 // Bad Practice // int points[3][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; // cout << points[1][2]; // 6 // cout << points[2][0]; // 7 // cout << points[2][2]; // 9 return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter