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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:14:24+00:00 2026-06-01T17:14:24+00:00

I am having trouble with code I am writing to convert a decimal to

  • 0

I am having trouble with code I am writing to convert a decimal to hexadecimal.

void decToHex (char *decString){
    char hexVal[100];
    sprintf(hexVal,"%x", *decString);
    *decString = hexVal;
    return;
}

compilation error: warning: assignment makes a pointer from an integer
without a cast (enabled by default); speaking of the line “*decString
= hexVal;” where I am trying to set my pointer value to the newly discovered hex value.

Does anyone know what I am doing wrong? I have read through some other posts that said this could be an issue with the compiler, however we are required for our class to use the standard c99 compiler built into our putty server. Any ideas on how to do this? I also tried creating an array of ints based on the modulus 16 idea, but I had even more issues with that.

  • 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-01T17:14:26+00:00Added an answer on June 1, 2026 at 5:14 pm

    *decString is a char. hexVal (in this context) is a pointer to char, so you try to store address in a char. hence the error.

    Even if you will do decString=hexVal, it will not work, for 2 reasons: it will change decString only in the function, and hexVal is a local variable, so it’s not valid outside of the function.

    Instead of this, copy the string from hexVal to decString: strcpy(decString, hexVal);.

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

Sidebar

Related Questions

I'm writing some code in python and I'm having trouble when trying to retrieve
I'm having trouble writing maintainable CSS code when font size is specified with EM
I am having trouble writing C++ code that uses a header file designed for
I am having trouble in writing a code in my speech recognition engine. The
So, I am writing some OpenCV C++ code and I am having trouble porting
Im having trouble with writing coloumn names using a FlexTable in GWT my code
I am having trouble writing to my XML file Here is my code: path
I'm having trouble in writing mutable dictionary to a file. Here's the code that
I am having trouble writing some Java code, which will create a container/folder in
I am having trouble with writing a simple(!) PHP function to return an array

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.