If I try to assign values to char array. It gives the error.
Error '=': cannot convert from 'const char [5]' to 'char'.
Why the values assigned to char array are always constant?
class Employee
{
public:
string name;
char id[100];
int age;
long salary;
Employee()
{
name = "NULL";
id[100]= "NULL";
age = 0;
salary = 0;
};
};
here i can't do assignment as "NULL" is considered as const char. while my id is char. why "NULL" is constant.
while if we individually check then we can change array values.
{
char i[10]="maha";
i[1]='z';
cout<<i[0]<<i[1]<<i[2]<<i[3]<<endl;
}