delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/01/21/07:45:07

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: Pai-Yi HSIAO <hsiao AT ccr DOT jussieu DOT fr>
Newsgroups: comp.lang.c,comp.os.msdos.djgpp
Subject: Re: Pointer Blues
Date: Mon, 21 Jan 2002 13:30:09 +0100
Organization: Universites Paris VI/Paris VII - France
Lines: 43
Message-ID: <Pine.A41.4.10.10201211319520.41928-100000@moka.ccr.jussieu.fr>
References: <ZNN28.965$903 DOT 5465 AT news>
NNTP-Posting-Host: moka.ccr.jussieu.fr
Mime-Version: 1.0
X-Trace: vishnu.jussieu.fr 1011616209 15567 134.157.1.23 (21 Jan 2002 12:30:09 GMT)
X-Complaints-To: newsmaster AT jussieu DOT fr
NNTP-Posting-Date: Mon, 21 Jan 2002 12:30:09 +0000 (UTC)
In-Reply-To: <ZNN28.965$903.5465@news>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 21 Jan 2002, Jake wrote:

> Pointers are begining to drive me crazy.
> If someone can follow the code and know whats going on please help me out.

I think you do not understand how to use pointer.
I propose to try to find some easier way to get what you want to do
instead of using pointer.
paiyi

#include <stdio.h>
#define columns  8
#define rows  8

int map [columns][rows] ={0};
int mask[columns][rows] ={0};

void initarray(int [columns][rows]); 
void display  (int [columns][rows]);

int main(int argc, char *argv[])
{
   int x,y;
   for ( y = 0; y < rows;y++)
     for (x=0;x<columns;x++){
       map [x][y] = x;
       mask[x][y] =x*2;
     }
   display(map);
   display(mask);
   return 0;
}
 
void display(int arr [columns][rows])
{
 int x,y;
 for (y=0; y<rows; y++){
   for (x=0; x < columns; x++) printf("%3d",arr[x][y]);
   puts("");
 }
 puts("");
}

- Raw text -


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