www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/05/20:42:04

From: DavMac AT iname DOT com (Davin McCall)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Pointers passed to functions
Date: Sat, 06 Nov 1999 00:41:47 GMT
Organization: Monash Uni
Lines: 37
Distribution: world
Message-ID: <38237902.991431@newsserver.cc.monash.edu.au>
References: <4cGU3.2300$1J5 DOT 254437 AT typhoon DOT mbnet DOT mb DOT ca>
NNTP-Posting-Host: damcc5.halls.monash.edu.au
X-Trace: towncrier.cc.monash.edu.au 941848916 8657 130.194.198.138 (6 Nov 1999 00:41:56 GMT)
X-Complaints-To: abuse AT monash DOT edu DOT au
NNTP-Posting-Date: 6 Nov 1999 00:41:56 GMT
X-Newsreader: Forte Free Agent 1.1/32.230
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

You must dereference a pointer to convert it to the type of value to
which it points. Building on your example, you should call draw_vimg
with:

	draw_vimg(*mygraphic, 200, 100, 1, 1);

Hope this helps.

Davin.


On Fri, 05 Nov 1999 19:26:56 GMT, "Philip Bock" <philipb AT escape DOT ca>
wrote:

>I have a function whose definition looks like this: (vimg is a struct)
>
>    void draw_vimg(vimg vectimg, int x, int y, int xscale, int yscale);
>
>I want to pass it a vimg defined like so: (gen_vimg creates and sets initail
>values for the struct)
>
>    vimg *mygraphic;
>    mygraphic = gen_vimg();
>
>So I call draw_vimg like this:
>
>    draw_vimg(mygraphic, 200, 100, 1, 1);
>
>And I get errors like this:
>
>    vector.cpp: In function `int main()':
>    vector.cpp:45: conversion from `vimg *' to non-scalar type `vimg'
>requested

__________________________________________________________
       *** davmac - sharkin'!! davmac AT iname DOT com ***
my programming page: http://yoyo.cc.monash.edu.au/~davmac/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019