jeudi 9 avril 2015

Comparing strings and if on C

I need to make a code which compare strings and assign a number for a string. I did this :



int metd=0;
if (strcmp( metodo, "GET")==1){
metd=1;
}
if (strcmp( metodo, "HEAD")==1){
metd=2;
}
if (strcmp( metodo, "PUT")==1){
metd=3;
}
if (strcmp( metodo, "DELETE")==1){
metd=4;
}


But at the end, metd always is 4. Some ideas?


Aucun commentaire:

Enregistrer un commentaire