1 / 8

Int [] a = new int [4];

Int [] a = new int [4];. Array is a list of variables having same name and same data type but accessed using index number. A[0]. A[1]. A[2]. A[3]. 10. Int[] b= new int[1];. B[0]. A[2]=10;. string[] b = new string[6]; . String[] n; n= new string[3]; n[0]=“faisal”; n[1]=“Israr”;

gunnar
Télécharger la présentation

Int [] a = new int [4];

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Int[] a = new int[4]; Array is a list of variables having same name and same data type but accessed using index number A[0] A[1] A[2] A[3] 10 Int[] b= new int[1]; B[0] A[2]=10; string[] b = new string[6];

  2. String[] n; n= new string[3]; n[0]=“faisal”; n[1]=“Israr”; n[2]=“javed”; n is nothing n[0] n[1] n[2] n[0] n[1] n[2] faisal Israr javed String[] n={“faisal”,”Israr”,”javed”};

  3. string[] weekDays = new string[] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; int[] array3; array3 = new int[] { 1, 3, 5, 7, 9 }; // OK array3 = {1, 3, 5, 7, 9}; // Error

  4. int[,] n = new int[2,3]; Int[,] n = new int[1][1]; n[0,2] 0 1 2 n[0,0] 0 0 0 1 int[, ,] n = new int[2,3, 3]; 0 1 2 n[1,0,2] 0 1 2 0 1

  5. int[,] arr2D = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; int[, ,] arr3D = new int[,,] { { { 1, 2, 3 } }, { { 4, 5, 6 } } }; int[,] array4 = { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; int[,] array5; array5 = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; // OK array5 = {{1,2}, {3,4}, {5,6}, {7,8}}; // Error

  6. int[][] a= new int[][]; a = new int[0][3]; a= new int[1][1]; Int[][] a; a=new int[1][1] {} A[0]=new integer[3]{} A[1]=new integer[1]{} 0 1 2 3 0 0 1 2 3 1 0 1 a[1][1] a[1][1]

  7. int[][] jaggedArray2 = new int[][] { new int[] {1,3,5,7,9}, new int[] {0,2,4,6}, new int[] {11,22} }; int[][,] jaggedArray4 = new int[3][,] { new int[,] { {1,3}, {5,7} }, new int[,] { {0,2}, {4,6}, {8,10} }, new int[,] { {11,22}, {99,88}, {0,9} } };

  8. QUESTIONS ?

More Related