Hi all,
I just started programming in C (I've learnt Java and Python), and this concept of pointers is driving me crazy. I know that basis of pointers, but when applying to a more complicated problem, it's really confusing. I was assigned a Connect 4 homework in which I have to use a single char array to represent the board game (6x7). There are a tons of suggested functions in the requirements (to help us work on the project), but most of them use pointers as function arguments and I've been struggling trying to figure out how they work.
I know this is nothing, but here is what I have so far:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#define RED 1;
#define BLACK 2;


static const int NUM_ROWS = 6;
static const int NUM_COLS = 7;




void menu() {
    printf("Welcome to the game connect 4 \n");
    printf("Please choose whether you want to be Red or Black below... \n");
}


// returning the position on the array, given the position of the board
int position(int row, int col) {
    int pos;
    pos = (row*7) + col;
    return pos;
}


void printBoard(char *grid) {
    
}
main() {
    char grid[NUM_ROWS*NUM_COLS];
    int i;
    printBoard(grid);
}
I'm working on getting void printBoard(char *grid) to print out the board, and with the char pointer as its argument, I really have no clue. Here is what the specs say for this function:

Code:
 void printBoard(char *grid);
   // pre: grid is a valid connect-four board array
// post: the board grid is printed to the screen
I've been reading about pointers yesterday. Any help of hints would be greatly appreciated. Thanks in advance everyone !