converting char to int?????

This is a discussion on converting char to int????? within the C Programming forums, part of the General Programming Boards category; Hi, i was wondering if anyone could tell me how to convert a char to an int while keeping the ...

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    2

    converting char to int?????

    Hi, i was wondering if anyone could tell me how to convert a char to an int while keeping the original value of the int?? for example if the number 23 was being read in from input into a variable
    char[4]; how could u convert it to an int so the int still contained 23??? thanx for any help.......

  2. #2
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    ask better questions


    i think what you want to do is this
    char str[] = "23";
    int x = 0;
    x = atoi(str);
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  3. #3
    ---
    Join Date
    May 2004
    Posts
    1,379
    Quote Originally Posted by PR1MO
    Hi, i was wondering if anyone could tell me how to convert a char to an int while keeping the original value of the int?? for example if the number 23 was being read in from input into a variable
    char[4]; how could u convert it to an int so the int still contained 23??? thanx for any help.......
    Hi, how do I convert a string to an integer?


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can some one please tell me the cause of the error ?
    By broli86 in forum C Programming
    Replies: 8
    Last Post: 06-26-2008, 08:36 PM
  2. Replies: 14
    Last Post: 06-28-2006, 01:58 AM
  3. Working with random like dice
    By SebastionV3 in forum C++ Programming
    Replies: 10
    Last Post: 05-26-2006, 09:16 PM
  4. Game Won't Compile
    By jothesmo in forum C++ Programming
    Replies: 2
    Last Post: 04-01-2006, 03:24 PM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21