benkas Posted May 13, 2008 at 02:34 PM Report Share #184829 Posted May 13, 2008 at 02:34 PM Boas Tenho uma pequena duvia. Gostaria de saber se a funcao atoi converte apenas a string "abcd" para inteiro ou apenas converte char's para inteiros e strings do tipo "1234"?? Link to comment Share on other sites More sharing options...
Baderous Posted May 13, 2008 at 02:44 PM Report Share #184830 Posted May 13, 2008 at 02:44 PM Se a função atoi encontrar uma string que não seja um conjunto de dígitos, retorna 0. atoi("1234") = 1234 atoi("asd") = 0 Link to comment Share on other sites More sharing options...
DanielAmorim Posted May 13, 2008 at 02:50 PM Report Share #184831 Posted May 13, 2008 at 02:50 PM A string passada a função tem de representar um numero inteiro, senão não dá... Vê a descrição da função aqui: http://www.cplusplus.com/reference/clibrary/cstdlib/atoi.html Daniel Amorim VP for xRTML http://www.xrtml.org http://www.realtime.co Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now