I have this code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
static char** testing(FILE *fp)
{
char temp[255];
char data[255][255];
for (int i = 0; !feof(fp); i++)
{
fgets(temp, 255, fp);
strcpy(data[i], temp);
}
for (int i = 0; i < 66; i++)
{
printf("%s", data[i]);
}
return data;
}
int main(int argc, char const *argv[])
{
FILE *fp;
fp = fopen(argv[1], "r");
testing(fp);
}
I want to return the 2D array data
but when I compile this, I get the output:
returning 'char (*)[255]' from a function with incompatible return type 'char **' [-Wincompatible-pointer-types] return data;
I don't see what I've done wrong.
Any help would be very much appreciated.