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

  • Home
  • SEARCH
  • 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 729365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:47:19+00:00 2026-05-14T06:47:19+00:00

I need an NSDictionary which has key in the form of string ( @key1,

  • 0

I need an NSDictionary which has key in the form of string (@"key1", @"key2") and value in the form of a C-style two-dimensional array (valueArray1,valueArray2) where valueArray1 is defined as :

int valueArray1[8][3] = { {25,10,65},{50,30,75},{60,45,80},{75,60,10},
                          {10,70,80},{90,30,80},{20,15,90},{20,20,15} };

And same for valueArray2.

My aim is given an NSString i need to fetch the corresponding two-dimensional array.
I guess using an NSArray, instead of c-style array, will work but then i cannot initialize the arrays as done above (i have many such arrays). If, however, that is doable please let me know how.

Currently the following is giving a warning “Passing argument 1 of ‘dictionaryWithObjectsAndKeys:’ from incompatible pointer type” :

NSDictionary *myDict = [NSDictionary dictionaryWithObjectsAndKeys:valueArray1,@"key1",
                    valueArray2,@"key2",nil];

  • 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-14T06:47:20+00:00Added an answer on May 14, 2026 at 6:47 am

    Is valueArray2 also an int[][3]? If so, you could use

    [NSValue valueWithPointer:valueArray1]
    

    to convert the array into an ObjC value. To retrieve the content, you need to use

    void* valuePtr = [[myDict objectForKey:@"key1"] pointerValue];
    int(*valueArr)[3] = valuePtr;
    // use valueArr as valueArrayX.
    

    If there’s just 2 keys, it is more efficient to use a function like

    int(*getMyValueArr(NSString* key))[3] {
        if ([key isEqualToString:@"key1"]) return valueArray1;
        else return valueArray2;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey, I need to make a HTTP POST request with an array of NSDictionary
hi i have an array of objects which need to be sorted (alphabet on
I have a NSTreeController which array is bound to a items (custom) property of
I created a plist that contains an NSDictionary structure. The key is a label
I have two custom objects, Phrase Book and Phrase, the Phrase Book has an
I need to solve the following question which i can't get to work by
i have a input tag which is non editable, but some times i need
I have a login.jsp page which contains a login form. Once logged in the
I have a large NSDictionary that I need to loop through and create separate
I have created an app which has a library of images. I have imported

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.