Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

char [] to int

Status
Not open for further replies.

sheila11

Programmer
Joined
Dec 27, 2000
Messages
251
Location
US
Hi all,

I have numbers (0 to 9) in a char array
( e.g. char deg[] = {'2','3'};)
that I need to convert to int values.

How can I do this?

TIA,
Sheila

 
Here is how you can do it:

#include <iostream>
using namespace std;
void main()
{
char array[9] = &quot;Hello !&quot;;
for( int i = 0; i < 9; i++ )
cout<<array<<&quot; = &quot;<< __toascii( array )<<&quot; &quot;;
}
 
Thanks, Leibnitz.
Sheila
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top