Warning!New windows update come out.

Monday, April 13, 2009

C programming question: how to send an array into functions?`?

I want to send an array "canvas" into each of the function prototypes, but the compiler always says the "row" and "column" in canvas[row][column] when I'm defining the functions are not defined there. What is wrong with what I'm putting?





Also, how am I supposed to send arrays into functions? What I have to send the array "canvas" into the functions are the last four lines of the code below, but it doesn't work. What should I do?





Please help! Thanks in advance!





#include <stdio.h>


#include <stdlib.h>


#define SIZE 25





void line(char canvas[row][column]);


void unfilled(char canvas[row][column]);


void filled(char canvas[row][column]);


void printarray(char canvas[row][column]);





int main(void)


{





int row, column;


char canvas[row][column];





printf("Welcome to the ASCII Art program.\n");


printf("Please make sure when entering your values that\nyou start from the left side going right\n");


printf("Have fun!\n");





line(canvas);


unfilled(canvas);


filled(canvas);


printarray(canvas);





} //end main function



You don't. Pass a POINTER to the first element of the array.

No comments:

Post a Comment

Help on computer for you