warning: passing arg 1 of `atoi' makes pointer from integer without a cast

Discussion in 'C Programming' started by francescomoi@europe.com, Apr 1, 2005.

  1. Guest

    Hi.

    I'm trying to compile this piece of source:

    -------------------------------------------
    int id;
    while(row1 = mysql_fetch_row(rs1))
    {
    id = atoi((int)row1[0]);
    -----------------------------------

    But I get this warning message:
    -------------------------------------
    warning: passing arg 1 of `atoi' makes pointer from integer without a
    cast
    -------------------------------------

    How can avoid this message?
     
    , Apr 1, 2005
    #1
    1. Advertising

  2. Guillaume Guest

    Re: warning: passing arg 1 of `atoi' makes pointer from integer withouta cast

    wrote:
    > Hi.
    >
    > I'm trying to compile this piece of source:
    >
    > -------------------------------------------
    > int id;
    > while(row1 = mysql_fetch_row(rs1))
    > {
    > id = atoi((int)row1[0]);
    > -----------------------------------
    >
    > But I get this warning message:
    > -------------------------------------
    > warning: passing arg 1 of `atoi' makes pointer from integer without a
    > cast
    > -------------------------------------
    >
    > How can avoid this message?


    atoi() expects a pointer to 'char'. What the heck is the cast to 'int'
    for?
     
    Guillaume, Apr 1, 2005
    #2
    1. Advertising

  3. Re: warning: passing arg 1 of `atoi' makes pointer from integer withouta cast

    wrote:
    > Hi.
    >
    > I'm trying to compile this piece of source:
    >
    > -------------------------------------------
    > int id;
    > while(row1 = mysql_fetch_row(rs1))
    > {
    > id = atoi((int)row1[0]);
    > -----------------------------------
    >
    > But I get this warning message:
    > -------------------------------------
    > warning: passing arg 1 of `atoi' makes pointer from integer without a
    > cast
    > -------------------------------------
    >
    > How can avoid this message?


    By not using an int as the argument to atoi().
     
    Martin Ambuhl, Apr 1, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rocke Robertson
    Replies:
    14
    Views:
    13,032
    Dan Pop
    Oct 2, 2003
  2. Markus Dehmann
    Replies:
    14
    Views:
    946
    Irrwahn Grausewitz
    Jun 28, 2004
  3. Dawn Minnis
    Replies:
    4
    Views:
    1,573
    Dawn Minnis
    Feb 20, 2005
  4. Juggernaut
    Replies:
    10
    Views:
    1,661
    CBFalconer
    Apr 9, 2005
  5. Ton 't Lam
    Replies:
    5
    Views:
    5,648
    Ton 't Lam
    Nov 26, 2008
Loading...

Share This Page