I Want to know why the first statements works and why not second one in c++
char a[10]=\"iqbal\"; // it works
a=\"iqbal\"; // does not work
When writing char a[10]="iqbal" You are initializing the elements of the character array a with the characters. We can do the same with int type (note that the char type gets a slightly different treatment) : int a[10]={1,2,...};
But writing the following after declaration part would be invalid as a would be treated just like a pointer. So writing something like a={1,2,...}; or a="iqbal" won't be making any sense!