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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:55:14+00:00 2026-06-14T12:55:14+00:00

It may be a really simple question, but I need to copy two int

  • 0

It may be a really simple question, but I need to copy two int values that are in array[0] and array[1] into a single integer.

As instance if array[0]=1 and array[1]=6, I need the integer to be equal to “16”.
Any element of the array has a range from 0 to 9.

What chances do I have?
Thank you a lot!

  • 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-14T12:55:15+00:00Added an answer on June 14, 2026 at 12:55 pm

    Does array[0] always represent the 10’s place and array[1] always represent the 1’s place? Will array[0] or array[1] ever have a value greater than 9 or less than 0? Will there ever be an array[2] or an array[3] to represent a 3 digit or a 4 digit number?

    If the answer to the above questions are Yes, No, and No, then isn’t the answer simple arithmetic?

    int result = (array[0] * 10) + array[1];
    

    If the data isn’t pre range-checked, then you’ll need to add that step. Even if the data IS pre range-checked, you should consider adding that step anyway to make extra sure.

    ’10’ is also a magic number in the above example. It would probably be wise to not hard-code 10, but base it off of the size of the array. Consider the case where there IS an array[2] . . . array[n]. What then?

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

Sidebar

Related Questions

May be its a simple question but it's really driving me crazy. I just
That may be really simple but I'm unable to find a good answer. How
This may be a really simple question, but I'm trying to create the database
My question may sound naive, but really struggling to do a very simple thing.
this may be a easy question, but I really need a light to go
This may be a really simple question, but I'm not sure what the most
OK, this may be really simple, but it is Friday and it has been
this may be a really n00b question, but if your list of params contains
This may be a really silly question, but it just crossed my mind and
This may be a really dumb question but I'm just starting to learn the

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.