string , strcpy , and arrays

what's wrong with that ??

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
void ajouter_mat()
                {   int i,k,r;
                char s[20];
                cout<<"\nentrer votre code Monsieur : ";
                cin>>k;
                for(i=0;i<ct;i++)
                {
                 if((this+i)->code==k)
                         { cout<<"\nEntrer l'id de la nouvelle matiere : ";
                          cin>>r; (this+ct-1)->id_mat = r;
                          cout<<"\entrer le nom de la nouvelle matiere : ";
                          cin>>s; (this+ct-1)->nom_mat=s;
                         }
                         else
                         cout<<" entrer un code valide !!";
                }


                }


it gives me error at ligne 12 ,
error: ISO C++ forbids assignment of arrays
plz help
what it says. you cannot assign arrays like that. use memcpy or strcpy if s is a c-string.
by the way, "this+i" is something you should not do..
what is "this + i" means?
where are you want it to point to?
never try to write a code like that before
i didn't gibe you the whole code , that's why you didn't undertand (this+i) , and about my problem , i solved it :)
ty anyway ^_^
I'm pretty sure we know what it means, it's just not a good idea to do...
Topic archived. No new replies allowed.