Use selected index value to retrieve value in array

Posted on 2009-02-10
Last Modified: 2012-05-06
I have a multi dimensional array as follows:

arr[0] = [500,40,50,10,7.5];
arr[1] = [1000,40,80,10,12];

and the value of a selected index, x
I want to compare x to the array in such a way that allows me to find the 3rd value in the row that corresponds to the value of the selected index

So, it x =1 I want to retrieve the value 80
Question by:Wayne9999
    1 Comment
    LVL 49

    Accepted Solution

    The third value is the one with index 2 (0,1,2)  so...
    value= arr[x][2]

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Title # Comments Views Activity
    Storing files into Microsoft Azure using AutoHotkey program 3 53
    only14 challenge 19 57
    haveThree challenge 22 88
    MaxSpan challenge 9 49
    This is an explanation of a simple data model to help parse a JSON feed
    Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now