Array C Programming Lecture 8 array c0 45

  • Slides: 18
Download presentation
Array C Programming Lecture 8

Array C Programming Lecture 8

���� array c[0] -45 c[1] 6 c[2] 0 c[3] 72 c[4] 1543 c[5] 78

���� array c[0] -45 c[1] 6 c[2] 0 c[3] 72 c[4] 1543 c[5] 78 ���������� array

�������� array #include <stdio. h> main() { int i, c[6]; for (i=0; i<6; i++)

�������� array #include <stdio. h> main() { int i, c[6]; for (i=0; i<6; i++) c[i] = 0; printf(“elementtvaluen”); } for(i=0; i<6; i++) { printf(“%dt”, i); printf("%dn", c[i]); } C Programming element 0 1 2 3 4 5 value 0 0 0

�������� array #include <stdio. h> main() { int i, c[6]={0}; printf(“elementtvaluen”); } for(i=0; i<6;

�������� array #include <stdio. h> main() { int i, c[6]={0}; printf(“elementtvaluen”); } for(i=0; i<6; i++) { printf(“%dt”, i); printf("%dn", c[i]); } C Programming element 0 1 2 3 4 5 value 0 0 0

�������� array #include <stdio. h> main() { int i, c[6]={4, 2}; printf(“elementtvaluen”); } for(i=0;

�������� array #include <stdio. h> main() { int i, c[6]={4, 2}; printf(“elementtvaluen”); } for(i=0; i<6; i++) { printf(“%dt”, i); printf("%dn", c[i]); } C Programming element 0 1 2 3 4 5 value 4 2 0 0

�������� array #include <stdio. h> main() { int i, c[6]={32, 27, 64, 18, 95,

�������� array #include <stdio. h> main() { int i, c[6]={32, 27, 64, 18, 95, 14}; printf(“elementtvaluen”); } for(i=0; i<6; i++) { printf(“%dt”, i); printf("%dn", c[i]); } C Programming element 0 1 2 3 4 5 value 32 27 64 18 95 14

#include <stdio. h> main() { int i, c[6]={4, 2}; printf(“elementtvaluen”); for(i=0; i<6; i++) {

#include <stdio. h> main() { int i, c[6]={4, 2}; printf(“elementtvaluen”); for(i=0; i<6; i++) { printf(“%dt”, i); printf("%dn", c[i]); } c[3] = 10; c[2+3] = 40/2; } printf(“nelementtvaluen”); for(i=0; i<6; i++) { printf(“%dt”, i); printf("%dn", c[i]); } C Programming element 0 1 2 3 4 5 value 4 2 0 0 element 0 1 2 3 4 5 value 4 2 0 10 0 20

�������� int c[2][3]={{1, 2, 3}, {8, 9, 10}}; Column 0 Column 1 Column 2

�������� int c[2][3]={{1, 2, 3}, {8, 9, 10}}; Column 0 Column 1 Column 2 Row 0 C[0][0] C[0][1] C[0][2] Row 1 C[1][0] C[1][1]

�������� int c[2][3]={{1, 2, 3}, {8, 9, 10}}; Column 0 Column 1 Column 2

�������� int c[2][3]={{1, 2, 3}, {8, 9, 10}}; Column 0 Column 1 Column 2 Row 0 1 2 3 Row 1 8 9 10

�������� array #include <stdio. h> main() { int i, j, c[2][3]={{1, 2, 3}, {8,

�������� array #include <stdio. h> main() { int i, j, c[2][3]={{1, 2, 3}, {8, 9, 10}}; } for(i=0; i<2; i++) { for(j=0; j<3; j++) { printf(“%dt”, c[i][j]); printf(“n"); } printf(“n”); } C Programming 1 8 2 9 3 10

#include <stdio. h> main() { int i, j, c[2][3]={{1, 2, 3}, {8, 9, 10}};

#include <stdio. h> main() { int i, j, c[2][3]={{1, 2, 3}, {8, 9, 10}}; for(i=0; i<2; i++) { for(j=0; j<3; j++) printf(“%dt”, c[i][j]); printf(“n”); } c[0][1] = c[0][1]*100; c[1][2] = c[1][1]*c[1][0]; } printf(“n”); for(i=0; i<2; i++) { for(j=0; j<3; j++) printf(“%dt”, c[i][j]); printf(“n”); } C Programming 1 8 2 9 3 10 1 8 200 9 3 72