Error on Function with Array
Hi to All
I am a new user of C++ an d I need help.
this is part of my program:
Code:
#define ADIM 5
...
char *otherString(char *Strings);
int main()
{
char firstString [5];
char secondString[5];
.
.
.
// for example the firstString is 'ABCD' + '\0'
// I need to create a secondString with a function as this
secondString=otherString(firstString);
}
// I have create this function
char *otherString(char *Strings)
{
char *tmpArray;
/* Allotion of Array */
tmpArray = new char*[];
for(int i=0; i<ADIM; i++)
tmpArray[i] = new char[ADIM];
tmpArray[0] = Strings[2];
tmpArray[1] = Strings[0];
tmpArray[2] = Strings[3];
tmpArray[3] = Strings[1];
tmpArray[4] = '\0';
return tmpArray;
}
During the compilation, VS return to me this errors.
Quote:
error C2440: '=': impossible to convert from 'char *' to 'char [5]' and other
Please, be patient with me. Can You help me to correct this code ?
Thank You and Best Regards