Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   warning: passing arg 1 of `atoi' makes pointer from integer without a cast (http://www.velocityreviews.com/forums/t437580-warning-passing-arg-1-of-atoi-makes-pointer-from-integer-without-a-cast.html)

francescomoi@europe.com 04-01-2005 04:50 PM

warning: passing arg 1 of `atoi' makes pointer from integer without a cast
 
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?


Guillaume 04-01-2005 04:55 PM

Re: warning: passing arg 1 of `atoi' makes pointer from integer withouta cast
 
francescomoi@europe.com 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?

Martin Ambuhl 04-01-2005 05:30 PM

Re: warning: passing arg 1 of `atoi' makes pointer from integer withouta cast
 
francescomoi@europe.com 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().




All times are GMT. The time now is 01:16 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.