Answer to Question #271668 in C for Christopher

Question #271668

Let's try defining the size of the array and create the contents of it on our own! And then, to give off a sense of excitement, let's try accessing the value of an array element in a random index position!




1
Expert's answer
2021-11-26T07:09:04-0500
#include <stdio.h>


int main()
{
    int n;
    int arr[]={5,7,12,9,10,15};
        printf("Enter the index of the element to access: ");
        scanf("%d",&n);
        printf("Element at index %d",n);
        printf(" is %d",arr[n]);


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS