I think I fixed the issue, I am getting these errors now, how can I correct this?
c:\Nick\C projects\portal>cl filename2.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
filename2.c
filename2.c(28) : warning C4047: '=' : 'char **' differs in levels of indirection from 'int'
filename2.c(32) : warning C4047: '=' : 'char *' differs in levels of indirection from 'int'
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:filename2.exe
filename2.obj
Code:
#include <stdio.h>
#include <string.h>
#define MAXLINES 100
#define MAXSTRING 300
char **arrFilename;
void getFilenames(char **arrFilename, int limit)
{
strcpy(arrFilename[0],"test");
strcpy(arrFilename[1],"test test test");
}
int main (void)
{
int i;
// allocate space for sting array
arrFilename = malloc( MAXLINES * sizeof(char *));
for ( i = 0; i < MAXLINES; i++)
{
// allocate space for each line
arrFilename[i] = malloc(MAXSTRING * sizeof(char));
}
getFilenames(arrFilename,MAXLINES );
printf("%s\n", arrFilename[0]);
printf("%s\n", arrFilename[1]);
}