having an issue while running my code on cygwin only getting one error which is at line 11. please spare me as i am a beginner. Trying to solve it from 8 hours straight but no luck edited the error to match the source code tried add an int between typedef int (*fun_ptr)... still same erroe
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define RED "\033[0;31m"
#define GREEN "\033[0;32m"
#define BLUE "\033[1;34m"
#define RESET "\033[0m"
typedef (*fun_ptr)(int**, int, int, char**, int, int);
void printBoard(int **board, int b_height, int b_width)
{
int i, j;
char ch;
printf(":) ||");
for (j = 0; j < b_width; j++)
{
printf(" %c |", 'A' + j);
}
printf("\n---++");
for (j = 0; j < b_width; j++)
{
printf("===+");
}
for (i = 0; i < b_height; i++)
{
printf("\n %d ||", i + 1);
for (j = 0; j < b_width; j++)
{
if (board[i][j] == -1)
{
ch = 'X';
printf(" %s%c%s |", RED, ch, RESET);
//printf(" X |");
}
else if (board[i][j] == -2) {
ch = '0';
printf(" %s%c%s |", GREEN, ch, RESET);
//printf(" 0 |");
}
else {
ch = '#';
printf(" %s%c%s |", BLUE, ch, RESET);
//printf(" # |");
}
}
printf("\n---++");
for (j = 0; j < b_width; j++)
{
printf("---+");
}
}
printf("\n");
}
error that i am getting
./source.c: line 11: syntax error near unexpected token `('
./source.c: line 11: `typedef (*fun_ptr) (int**, int, int, char**, int, int);'
warning: type defaults to ‘int’ in declaration of ‘fun_ptr’ [-Wimplicit-int], not a syntax error. When I addintaftertypedef, it compiles without error. If you're getting a syntax error after addingint, the problem is in code you haven't shown us. This is why we need a minimal reproducible example (read that link).