D
dwaach
Hi,
I am trying to compile the following program,
#include <iostream>
using namespace std;
typedef char* CHAR;
typedef const CHAR CCHAR;
void test(CCHAR pp)
{
cout<<"hello"<<endl;
}
void main()
{
const char* myChar = "tt";
test(myChar);
}
Output:
error: 'test' : cannot convert parameter 1 from 'const char *' to 'char
*const '
Conversion loses qualifiers
Why ?
How to resolve this ?
Regards,
Abhishek
I am trying to compile the following program,
#include <iostream>
using namespace std;
typedef char* CHAR;
typedef const CHAR CCHAR;
void test(CCHAR pp)
{
cout<<"hello"<<endl;
}
void main()
{
const char* myChar = "tt";
test(myChar);
}
Output:
error: 'test' : cannot convert parameter 1 from 'const char *' to 'char
*const '
Conversion loses qualifiers
Why ?
How to resolve this ?
Regards,
Abhishek