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 713689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:59:21+00:00 2026-05-14T04:59:21+00:00

I used, for(id value in values) to get the value from an NSArray. Now

  • 0

I used,
for(id value in values) to get the value from an NSArray. Now I want to store it in 2 dimensional float array[][]. When I try to assign the values to array it is giving error:incompatible types in assignment.
I tried to cast the value but I got error: pointer value used where a floating point value was expected. I need to store the values in an 2 dimensional array . How can I make it ?
Thank You.

@implementation fromFileRead1
NSString *fileNameString;
int numberOfEnemies, numberOfValues;
-(id)init
{
    if( (self = [super init]) ) 
    {
        NSString *path = @"/Users/sridhar/Desktop/Projects/exampleOnFile2/enemyDetals.txt";
        NSString *contentsOfFile = [[NSString alloc] initWithContentsOfFile:path];
        NSArray *lines = [contentsOfFile componentsSeparatedByString:@"\n"]; 
        numberOfEnemies = [lines count];
        NSLog(@"The number of Lines: %d", numberOfEnemies);
        for (id line in lines)
        {
            NSLog(@"Line %@", line );
            NSString *string1 = line;
            NSArray *split1 = [string1 componentsSeparatedByString:@","];
            numberOfValues = [split1 count];
            NSLog(@"The number of values in Row: %d", numberOfValues);
            for (id value in split1)
            {
                NSLog(@"value %@", value);
                float value1;
                value1 = [split1 objectAtIndex:2]);
                NSLog(@"VAlue of Value1 at index 2: %f", value1 );
            }
        }
    }
    return self;
}
@end

In enemyDetal.txt I have

1,3,3
2,3,2.8
10,2,1.6
  • 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-14T04:59:21+00:00Added an answer on May 14, 2026 at 4:59 am

    Storing an object (e.g. id) in a float array is most certainly not what you want, and will give you the weirdest results.

    The question is what you really want to do. If you have NSNumber objects in your array containing float values, then you can use [value floatValue] to convert your object to a float primitive.

    If your intention was really to store a pointer as a float try (float)((int)value)). This might work but be warned that this you will most likely not be able to retrieve the pointer again.

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

Sidebar

Related Questions

I want to get value in a date picker and add to textfield_date..I used
i have used dictionary to collect the array of values i have value in
I used the following function: function datediff() { var dat1 = document.getElementById('date1').value; alert(dat1);//i get
When I want to find the last used cell value, I use: Dim LastRow
I have a form submit, where it get the values from the form and
i want to know that how to get multiple selectbox values in php means
I have used web service and get the response as the JSON. I want
we are trying to implement ajax in new incident to get values of assign
I was trying to retrieve value from two tables by joining, but few values
Right, so I have an enumerable and wish to get distinct values from it.

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.