Re: Question in C
- From: "John (J5) Palmieri" <johnp martianrock com>
- To: John Coppens <john jcoppens com>
- Cc: Thomas Keaney <se40319 cs may ie>, gtk-app-devel-list gnome org
- Subject: Re: Question in C
- Date: Fri, 20 Feb 2004 13:19:31 -0500
On Fri, 2004-02-20 at 13:02, John Coppens wrote:
On Fri, 20 Feb 2004 17:27:18 -0000
"Thomas Keaney" <se40319 cs may ie> wrote:
Hi,
How would I change a char to an int. I have the value "34" as a
character. I want to change this to an int (34). Cheers
char is in fact an (smaller) int. So you can just assign the char value to
an int - no problem.
Uh, don't do that. First
char a[] = "34";
int b = a;
would give you the address of the pointer a. Second.
char a[] = "34";
int b = a[0];
would give you the ascii character code for '3'
--
J5
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]