WAP to create an array with 10 size and of int holding ability. Store values 1-10 in it. Using the length variable, access each element of the array and print it to the console. Create the array in 2 ways - one using the new operator and then storing the values individually, two by creating the array with the values directly in the array. Loop over the array using an index variable and the enhanced for as well.

1

Answers

  • Brainly User
2014-05-14T12:27:16+05:30
Solution : WAP to create an array with 10 size and of int holding ability. Store values 1-10 in it. Using the length variable, access each element of the array and print it to the console

#include <stdio.h>
#include <conio.h>
void main()
{
int arr[10] ={1,2,3,4,5,6,7,8,9,10};
int len=10 , i;

for ( i = 0 ; i < len ; i ++ )
{
 printf ("%d \t ",arr[i])
}
getch();
}


0