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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:16:02+00:00 2026-06-01T00:16:02+00:00

So at first i was trying to use character at index, then convert it

  • 0

So at first i was trying to use character at index, then convert it to nsnumber, and then get the int value, but for 9 i got a value of 57. So I knew what was going wrong, I’m getting the int of the character itself.

So I read a little, and found atoi, but I get this error, that doesnt crash my app jsut pauses it.

My code is:
int current = atoi([startSquares characterAtIndex: i]);

Now startSquares is a big string full of numbers, and this above line is in a for loop where i goes from 0 to 99.

  • 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-06-01T00:16:04+00:00Added an answer on June 1, 2026 at 12:16 am

    57 is ASCII for the digit '9'. Assuming that by the “value of the char” you mean “the numeric value of the digit the char represents”, you can use the simple trick available in ASCII:

    int digit = char - '0';
    

    This trick works, because all digits are encoded in order starting with the digit zero (ASCII code 48). So when you subtract '0' (which is another way to write 48) from 57, you get 9, the value of the digit '9'.

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

Sidebar

Related Questions

I was trying to use RoR or ASP.NET MVC but at my first impression
I am trying to get the index of the Nth character inside a varchar(MAX).
I am trying to use an update query to update the first 3 characters
this is my first time trying to use document classes in AS3 and im
I'm trying to use an event listener for the first time. All samples I've
I'm trying to use Unix cut to remove the first two fields per line.
I'm trying to use GSP outside grails and ran to my first problem. I
I'm trying to use a for line in data: loop to assign the first
Question I am trying to use a button to delete the first entry to
I am trying to use the Google generated API library for the first time

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.