error conversion from array to int in c language

Asked

Viewed 26 times

0

Could someone help me understand what error I am making in this conversion. because any digit to print the last characters of the variable key_temp, key_temp2 or key, he is printing ' 0'.

// copies the data from argv1 to the key variable strcpy(key_temp2, argv[1]); // copies the string argv[1] to the key char_temp

for(int i = 0; i < compr_argv1; i++)            // tive que copiar a chave_temp2 para a chave_temp, porque estava gerando falha
{
    chave_temp[i] = chave_temp2[i];
    chave[i] = chave_temp[i];
}
  • Because you do not use strcpy to copy also to key & key?

  • i had used strcpy for the temp_key, but there was an error in the conversion, too. so I made a strcpy in the temp_key to copy it via "for". With the variable "key" I do not know if it is possible to use strcpy, because it is an int.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.