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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:29:01+00:00 2026-06-17T20:29:01+00:00

Possible Duplicate: How to convert integer to string in C? I have a function

  • 0

Possible Duplicate:
How to convert integer to string in C?

I have a function in C which takes an int value i. I need to turn this i value into a string (char *).

Here is what I have so far:

char *str = (char *)i;
myfunction(str);

I get the error: cast to pointer from integer of different size.

Thanks!

  • 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-17T20:29:02+00:00Added an answer on June 17, 2026 at 8:29 pm

    This is just not valid code. Even if you resolve the compile-time error, the result will likely be some sort of memory access error at run time. The result will be a pointer to a string that you have no idea where it actually points to. And so you’ll have an error when your program accesses that memory.

    I’m going to speculate that what you are really looking for is a function like itoa(). That’s the only way this would make any sense.

    Edit

    Based on a new comment, I see that you do in fact want a function like itoa(). Simply trying to convert the integer to a string pointer will not do what you want.

    char buff[80];
    
    itoa(i, buff, 10);
    myfunction(buff);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Convert this string to datetime I have to convert my string value
Possible Duplicate: How to convert List<Integer> to int[] in Java? I have an ArrayList
Possible Duplicate: Convert NSDate to NSString convert string to nsdate Currently I have this
Possible Duplicate: how can I convert String to Int ? Hi, I have the
Possible Duplicate: Convert.ToInt32() a string with Commas i have a value in the label
Possible Duplicate: Split string, convert ToList<int>() in one line… i have a string that
Possible Duplicate: How do I convert hex string into signed integer? example:3A convert to
Possible Duplicate: Safe integer parsing in Ruby int.Parse converts a string into an integer,
Possible Duplicate: Convert ascii to int ?? int a=53 This is an ASCII value
Possible Duplicate: How do I convert a string into an integer in objective C?

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.