From: "Cliff Rhodes" Newsgroups: comp.os.msdos.djgpp,comp.lang.c Subject: Re: Functions in struct's... possible? How? Date: 22 Aug 1997 03:04:52 GMT Organization: Flashnet Communications, http://www.flash.net Lines: 21 Message-ID: <01bcaea8$2e22c2a0$e3441ed1@crhodes.flash.net> References: <33FCDA5C DOT 2353659F AT execulink DOT com> NNTP-Posting-Host: hsh8-227.flash.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Jeff Weeks wrote > I'd like to have a function in a struct that I've created. I realise I > can't just stick a functions in there, so I used a pointer to a > function. That's the right approach. > char *virt = (char *)malloc(640*480*2); Did you ever check the return value from malloc()? I think you will have a surprise. > driver.blit(virt); > > Can C not do this? Is there no way to call a function from a struct? > If there is a way (perferable a portable way!) could you please tell me. Your method is correct. Your allocation is bad. You'll need to use the correct method to allocate a large block for your system.