Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7613147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:05:26+00:00 2026-05-31T02:05:26+00:00

I have values i wanted to load dynamically in an array, here are the

  • 0

I have values i wanted to load dynamically in an array, here are the examples

First of all i define 3 different values in my init, and then in my array i want it to determine which value to read. Example:
First i define the value

int value1=20
int value2=40;
int value3=60;

i then define another int in my array called valueToLoad, and i’ll give each of them a number tag. and i want the individual array item to read different value based on their number tag so that Item 1 will read value1, Item 2 will read value2 and so on. i tried the method below to convert NSString into int:

NSString *valueVariable=[NSString stringWithFormat:@"value%d",i]; (i being the number tag)
int valueToRead = [valueVariable intValue];

unfortunately, this conversion doesn’t supports conversion of any other thing except if the string is actual integer.
However i do not want to run the IF statement to do:

if(tag==1)
{ int valueToLoad= value1;}

For who don’t understand. I am just trying to read different Int value in an array based on the number of array. Let’s assume i have 3 Items in array naming A,B,and C. i want Item A to read Value 1, ItemB to read Value2 and so on.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:05:26+00:00Added an answer on May 31, 2026 at 2:05 am

    Why don’t you simply do something like

    int values[] = {20,40,60};
    
    ...
    
    int valueToRead = values[i]; //or i-1, depending if i starts from 0 or 1
    

    ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have two arrays, items and removeItems and I wanted any values found
I am looking for a way to edit data and have values dynamically calculated
I have a couple of CSV files I want to load into my database,
So I have a PHP file that I use to define all my constants
I have a .Net windows forms application, and I need to load values into
I have a dropdown menu bounded with values from the db on form load.
I have a datatable which contains a load of dates. I wanted to group
I have values stored as strings in a DataTable where each value could really
I have values that are 64-bit unsigned ints, and I need to store them
Consider the scenario I have values assigned like these Amazon -1 Walmart -2 Target

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.