_LiveGreen_
2012-01-12 05:06:49 UTC
error C2664: 'display' : cannot convert parameter 1 from 'char [5][50]' to 'char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
please help me understand and fix the code thanks!
#include
#include
#include
#include
using namespace std;
void start();
//void inputstr(char *str);
void display(char *result);
char str[5][50];
void main()
{ system("cls");
start();
getch();
}
void start()
{
int i=0;
for(i=0;i<5;i++)
{ printf("Enter string %d:",i+1);
gets(str[i]);
}
display(str); \\<--- i have error here! its says that arguement of type "char(*)[5] is incompatible with parameter of type "char * " \\
}
void display(char *result)
{ int i=0;
for(i=0;i<5;i++)
{
printf(" %s",result[i]);
}
getch();
}