How to print single array value.
array similar datatype collection.
declaration | initialization
int[] arr = new int[3];
arr[0] = 1;
arr[1] = 2;
arr[2] = 3;
Response.Write(arr[2]);
ptint second value in array;
int[] arr = new int[]{ 1, 2, 3, };
for (int i = 0; i < arr.Length; i++)
{
Response.Write(arr[i]);
Response.Write("<br>");
}
string[] arr = new string[4]{"hi","how","are","u"};
for (int i = 0; i < arr.Length; i++)
{
Response.Write(arr[i]);
Response.Write("<br>");
}
in place of response.write c programmers can write "printf".
in java "System.out.println". this example shows array with int and string data-type
0 comments: