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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:37:53+00:00 2026-05-25T15:37:53+00:00

I am programming in C and I have a character array filled with letters/numbers.

  • 0

I am programming in C and I have a character array filled with letters/numbers. I want to compare the first two values together as one number or combo.

char values[8];
//a value of this might be 245756
switch (values[0 and 1]){
   case 24:
     do something;
   case 45:
     do something else;
}

Do I have to concatenate or what if I want to combine the two values and then see if they equal some set of combinations?

Thanks!

Please let me know if I am being unclear.

  • 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-25T15:37:54+00:00Added an answer on May 25, 2026 at 3:37 pm

    I’m assuming that your char array holds the characters '2', '4', etc.

    In which case, you can convert a character to its equivalent integer value as follows:

    char x = '2';
    int  y = x - '0';
    

    So all you need to do is perform this calculation for each of values[0] and values[1], and then perform the base-10 maths to combine these into a single integer value.

    If your char array already holds the integer value for each digit, then you can of course skip the conversion, and jump straight to the base-10 maths.

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

Sidebar

Related Questions

I have a form with two text boxes, in one I want to show
I have an interesting programming puzzle for you: You will be given two things:
How do I change one character in a file? Any nix-compliant programming language solution
I want to sort values of an array in alphabetical order in PHP. If
I have a number of student with java programming assigment written using (most probabaly)
I have the string page-24 and want to replace 24 by any other number.
i have been programming for sometime but all of my programming books have not
I have just started programming and have made a few small applications in C
different programming languages have different features or lack certain features. Design patterns are a
The last GUI programming I have done was with Visual Basic, which included objects

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.