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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:29:09+00:00 2026-06-13T05:29:09+00:00

I am creating a program to convert from binary, decimal, hex, and oct to

  • 0

I am creating a program to convert from binary, decimal, hex, and oct to any one of those options. For hex, I need a way to format values greater than 9 into one of A, B, C, D, E, F. Since this will be repeated in several functions, I decided to make the following function:

char hexRepresentation(double n){
    if(n > 9){
        if(n==10) return 'A';
        if(n==11) return 'B';
        if(n==12) return 'C';
        if(n==13) return 'D';
        if(n==14) return 'E';
        if(n==15) return 'F';
    }

    return (char)n;
}

However, when I try to compile, I receive the error

conflicting types for ‘hexRepresentation’

I’m utterly new at C, coming from Java, and am banging my head against a wall over what should be the simplest things to implement. Any help would be greatly appreciated!

  • 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-13T05:29:11+00:00Added an answer on June 13, 2026 at 5:29 am

    You don’t get a declaration kind-of error because in C, when you do not forward declare a function most compilers assume an extern function that returns an int type. Actually the compiler should warn you about this (most do). Then later on when the compiler actually reaches the function implementation it finds a different return type, in this case a char, and then throws the “conflicting type” error. Just forward declare all the functions to avoid this kind of errors.

    About what would be the best way somthing like following code woudl yield a similar result:

    if (n > 9)
    {
       return('A' + (n - 10));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a program where the kids must convert a decimal value (I.E. 0.xxxx
Bassicly im creating a program that reads information from an xml file into a
I'm creating a program that authenticates from a before it runs. I also want
I have a program that downloads a binary file, from another PC. I also
I am creating a program using wxpython which entails the need to create many
I am creating a cron job in which I copy files from one directroy
I'm creating a program that invents a new Sudoku puzzle. The way I initially
I creating a program which send newsletter with a background image. It works fine
I am creating a program used to connect to a embedded bluetooth device with
I'm creating a program in VB.NET to output multiple images. Some images will have

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.