2D Array - int a[4[3 int row,col for(row=0;row<4;row...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//load 2d arraw with parameter passing #include <stdio.h> /* //prototype: void load(int [][3]); (same w/o variable) void load(int a[][3]) //always leave first subscript blank { int row,col; for(row=0;row<4;row++) for(col=0;col<3;col++) { printf("Enter a # "); scanf("%d",&a[row][col]); } } void print(int a[][3]) { int row,col; for(row=0;row<4;row++) { for(col=0;col<3;col++) printf("%d\t",a[row][col]); printf("\n"); } } void main() { int a[4][3]; load(a); print(a); } */ //load 2d array #include <stdio.h> void main()
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { int a[4][3]; int row,col; for(row=0;row<4;row++) for(col=0;col<3;col++) { printf("Enter a # "); scanf("%d",&a[row][col]); } //print array for(row=0;row<4;row++) { for(col=0;col<3;col++) printf("%d\t",a[row][col]); printf("\n"); } } /* Enter a # 1 Enter a # 2 Enter a # 3 Enter a # 4 Enter a # 5 Enter a # 6 Enter a # 7 Enter a # 8 Enter a # 9 Enter a # 10 Enter a # 11 Enter a # 12 1 2 3 4 5 6 7 8 9 10 11 12 Press any key to continue . . . */...
View Full Document

This note was uploaded on 10/05/2011 for the course CS 36 taught by Professor Sethhochwald during the Spring '09 term at Irvine Valley College.

Page1 / 2

2D Array - int a[4[3 int row,col for(row=0;row<4;row...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online