473,386 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Int to char Array

I was wondering how to take an integer and store it into a char array, if anyone could tell me that would be great.
Jul 20 '07 #1
4 15910
Change the int into a string.
Jul 21 '07 #2
prometheuzz
197 Expert 100+
Change the int into a string.
@OP:
Yes, Joe is right. I'd just like to point you to the class that would be able to assist you on this. It's perhaps no surprise, but it's the java.lang.String class:
http://java.sun.com/j2se/1.5.0/docs/...ng/String.html
Especially look at the valueOf(...) and toCharArray() methods.

Good luck.
Jul 21 '07 #3
I don't know if I'm just not getting it, or I asked the wrong question but what I want to do is take a pre-existing character array, and store a series of integers into it.
Jul 21 '07 #4
JosAH
11,448 Expert 8TB
I don't know if I'm just not getting it, or I asked the wrong question but what I want to do is take a pre-existing character array, and store a series of integers into it.
You have to rephrase your question a bit then: given an int, do you want to store
the individual characters of the decimal representation of that int in that array or
do you want something else to happen? A pre-existing array of chars may be too
small to hold the result ...

kind regards,

Jos
Jul 21 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

35
by: Ying Yang | last post by:
Hi, whats the difference between: char* a = new char; char* b = new char; char c ;
21
by: Bret | last post by:
I'm curious why char** argv is acceptable in the main() declaration. In the comp.lang.c FAQ (question 6.18) it says that pointers to pointers and pointers to an array are not interchangable. ...
19
by: gaga | last post by:
I can't seem to get this to work: #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char *names; char **np;
5
by: jab3 | last post by:
(again :)) Hello everyone. I'll ask this even at risk of being accused of not researching adequately. My question (before longer reasoning) is: How does declaring (or defining, whatever) a...
12
by: arkobose | last post by:
my earlier post titled: "How to input strings of any lengths into arrays of type: char *array ?" seems to have created a confusion. therefore i paraphrase my problem below. consider the...
13
by: chellappa | last post by:
hi , please explain me , char pointer , char Array, char ,string... i have some many confussion about this... please clarify to me.. i need some example about this program by chellappa.ns
15
by: Kueishiong Tu | last post by:
How do I convert a Byte array (unsigned char managed) to a char array(unmanaged) with wide character taken into account?
5
by: Stephen Cawood | last post by:
I'm trying to use a C++ .lib from C# (I tried the Interop group will no results). I have a working wrapper DLL (I can get back simple things like int), but I'm having issues dealing with an array...
2
by: Michael | last post by:
Hi, How to understand the difference between the following three. My understanding is the number in bracket minus one is the max number of chars to store in the char array , right? ...
3
by: ZMan | last post by:
The following code won't compile with gcc version 3.4.2 (mingw-special). How come? Error: cannot convert `char (*)' to `char**' /**********************************************************/...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.