delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/21/15:42:27

From: "A. Sinan Unur" <sinan AT unur DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Arrays in C or a completely new way to restart your PC ;-)
Date: Fri, 21 Apr 2000 14:20:46 -0400
Organization: http://unur.com/
Lines: 51
Sender: verified_for_usenet AT cornell DOT edu (asu1 on 128.253.251.163)
Message-ID: <8dq67b$ork$1@news01.cit.cornell.edu>
References: <0fd549f4 DOT 922d8d61 AT usw-ex0110-075 DOT remarq DOT com>
NNTP-Posting-Host: 128.253.251.163
X-Trace: news01.cit.cornell.edu 956341291 25460 128.253.251.163 (21 Apr 2000 18:21:31 GMT)
X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu
NNTP-Posting-Date: 21 Apr 2000 18:21:31 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-Mimeole: Produced By Microsoft MimeOLE V5.00.2919.6600
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Bernhard Stiftner" <stiftnersoftwareNOstSPAM AT gmx DOT net DOT invalid> wrote in
message news:0fd549f4 DOT 922d8d61 AT usw-ex0110-075 DOT remarq DOT com...

> C (I know that this does perhaps not fit into a DJGPP newsgroup, sorry,
but I think (or at
> least I hope) that somebody could help me here, too (please!!!)...).

this statement is correct. you should post basic C related questions to
either news:comp.lang.c or news:comp.lang.c.moderated. while you are at it,
also check out the comp.lang.c FAQ before posting.

> BITMAP *ani1[5]; /* I think this sets up an array of 6
> pointers (ranging von 0 to 5) to these BITMAPs */

actually no ...there is room for exactly 5 pointers (which is what you asked
for) the index ranges from 0 to 4.

> PALLETE junk;
>
> void load_animation(void) { /* load the files ANI000.BMP to
> ANI005.BMP into the array */
>   int i;
>   char *str;
>   char *buf;
>   char *fname;
>   for (i=0; i<6; i++) {
>     itoa(i-1, str, 10);

str points to deep space. it needs to point to valid storage.

>     buf = strcat("ani100", str);

ditto.

>     fname = strcat(buf, ".bmp");

ditto*ditto.

> So, I don't know what's wrong with my code...
> PS: I'm currently trying to teach C/C++ myself (not an easy
> task - after all, I'm a 15 years old student and I have to
> invest ***huge*** amounts of time in school (although I try
> to reduce that to the absolute minimum...))

this is not as good as an excuse as you think it is ... relax.
--
mailto:Sinan_Unur AT mail DOT com
http://unur.com/



- Raw text -


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