makes pointer from integer without a cast

makes pointer from integer whithout a cast

Page 1 of 1

6 Replies - 2188 Views - Last Post: 15 July 2010 - 04:47 PM Rate Topic: -----

#1 Loreena D.  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 15-July 10

makes pointer from integer without a cast

Posted 15 July 2010 - 12:25 PM

Hello,

I having a problem on my program :

char Modelo[256];	
glp_tran *tran;


int *ReadModel(glp_tran *tran,const char *Modelo,int skip)

{

	return (glp_mpl_read_model(tran, Modelo,skip));
            /* Problem on this line /makes pointer  from integer whithout a cast
}



ret= ReadModel(tran,Modelo,1);       //lendo modelo               /* And here the same kind of problem/ assignment makes integer from pointer whithout a cast



Could show me where is wrong??

Thanks in advance
Loreena

This post has been edited by sarmanu: 15 July 2010 - 12:32 PM
Reason for edit:: Fixed code tags. Please put your code in between [code] ... [/code].


Is This A Good Question/Topic? 0
  • +

Replies To: makes pointer from integer without a cast

#2 Loreena D.  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 15-July 10

Re: makes pointer from integer without a cast

Posted 15 July 2010 - 12:26 PM

Hello,

I having a problem on my program :

char Modelo[256];	
glp_tran *tran;


int *ReadModel(glp_tran *tran,const char *Modelo,int skip)

{

	return (glp_mpl_read_model(tran, Modelo,skip));
            /* Problem on this line /makes pointer  from integer whithout a cast
}



ret= ReadModel(tran,Modelo,1);       //read modelo               /* And here the same kind of problem/ assignment makes integer from pointer whithout a cast



Could show me where is wrong??

Thanks in advance
Loreena

This post has been edited by sarmanu: 15 July 2010 - 12:33 PM
Reason for edit:: Fixed code tags. Please put your code in between [code] ... [/code].

Was This Post Helpful? 0
  • +
  • -

#3 taylorc8  Icon User is offline

  • B&

Reputation: 149
  • View blog
  • Posts: 1,572
  • Joined: 21-July 09

Re: makes pointer from integer without a cast

Posted 15 July 2010 - 12:32 PM

I don't know how to fix your problem because it doesn't seem you can effectively communicate it to me.

perhaps posting the function which is causing you problems would help.

this may or may not be the solution to your problem:

& // <--
Was This Post Helpful? 0
  • +
  • -

#4 Loreena D.  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 15-July 10

Re: makes pointer from integer without a cast

Posted 15 July 2010 - 03:02 PM

Hi Taylor,

I have an file which contains the model of my problem , which i pass by script In resume like this
char Model[256];
...
strcpy(Model, argv[2]);

And then call this function here on main.
int *ReadModel(glp_tran *tran,const char *Model,int skip)

{

return (glp_mpl_read_model(tran, Model,skip)); ////
On this line appears :makes pointer from integer whithout a cast
}


main()
glp_tran *tran;
...
ret= ReadModel(tran,Model,1); /// on this line appears :makes integer from pointer


On the manual its used like this:
glp_tran *tran;
int ret;

ret = glp_mpl_read_model(tran, "model.mod", 1);


Hope its a bit clearer

Thanks in advance
Was This Post Helpful? 0
  • +
  • -

#5 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: makes pointer from integer without a cast

Posted 15 July 2010 - 03:29 PM

ret is an integer. ReadModel returns a pointer to an integer. So how is that you decide to store a pointer to an integer in a variable of type...integer?
Was This Post Helpful? 0
  • +
  • -

#6 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1325
  • View blog
  • Posts: 4,551
  • Joined: 19-February 09

Re: makes pointer from integer without a cast

Posted 15 July 2010 - 03:31 PM

You have

int *ReadModel(glp_tran *tran,const char *Modelo,int skip)
{
  /* Problem on this line makes pointer from integer without a cast
  return (glp_mpl_read_model(tran, Modelo,skip));
}



If I understand your problem it is with the return of a pointer to int.
This is automatically generated because the return type is int pointer.

So remove the asterisk before function name.
int ReadModel(glp_tran *tran,const char *Modelo,int skip)
{
  return (glp_mpl_read_model(tran, Modelo,skip));
}


This post has been edited by #define: 15 July 2010 - 03:33 PM

Was This Post Helpful? 0
  • +
  • -

#7 Loreena D.  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 15-July 10

Re: makes pointer from integer without a cast

Posted 15 July 2010 - 04:47 PM

That was the problem,
thank you all.

Regards
Loreena
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1