I'm trying to write a function that manipulates an array directly.I don't want to return anything, so obviously I'm going to be using pointers in some fashion.
In C when you pass array automatically the base address of the array is stored by the formal parameter of the called function(here, makeGraph()) so any changes done to the formal parameter also effects the actual parameter of the calling function(in your case main()).
So you can do this way:
void makeGraph(char graph[][60])
{
//body of the function...
}
int main(void)
{
//in main you can call it this way:
char graph[40][60];
makeGraph(graph)
}
There are even other ways you can pass an array in C. Have a look at this post: Correct way of passing 2 dimensional array into a function
void makeGraph(char graph[][60]) {note that you don't need to specify the first dimension, call it usingmakeGraph(graph)void makeGraph(int rows, int cols, char graph[rows][cols]),makeGraph(40, 60, graph)