Im new to C programming and am trying to complete a program for class which prints an array and then takes user input to make a picture out of 'X's. Right now Im just trying to create the part where it makes a straight line, however, im confused about calling functions and using arrays and was hoping some kind sole could give me a little help anything would be very much appreciated.
here is what I have so far
Code:
#include<stdio.h>
#include <string.h>
#include <ctype.h>
#define SIZE 25
void Line(char array[25][25]);
int main()
{
int row;
int column;
char array[SIZE][SIZE];
//set array to space character
for(row=0;row<SIZE;row++){
for(column=0;column<SIZE;column++){
array[row][column]=' ';
}
}
//print out array (notice the brackets are here NOT in the set for loops)
for(row=0;row<SIZE;row++){
for(column=0;column<SIZE;column++){
printf("[%c]",array[row][column]);
}
printf("\n");
}
Line(char array[SIZE][SIZE]);
}
void Line(char array[25][25])
{
int RowStart;
int ColStart;
int RowEnd;
int ColEnd;
int i;
int j;
printf("Enter starting row: ");
scanf("%d\n", &RowStart);
printf("Enter starting column: ");
scanf("%d\n", &ColStart);
printf("Enter ending row: ");
scanf("%d\n", &RowEnd);
printf("Enter ending column: ");
scanf("%d\n", &ColEnd);
for(i=RowStart; i<RowEnd; i++){
for(j=ColStart; j<ColEnd; j++)
printf("X", array[i][j]);
}
}
Thanks