Jump to content

String para um inteiro


Recommended Posts

Posted

Fazes outro array com a marca

                int[]            char[]
index         O_TEU_ARRAY     O_OUTRO_ARRAY
  0             453666             ' '
  1                 12             'X'
  2              -8989             'X'
  3                  4             ' '
  4                 42             ' '

What have you tried?

Não respondo a dúvidas por PM

A minha bola de cristal está para compor; deve ficar pronta para a semana.

Torna os teus tópicos mais atractivos e legíveis usando a tag CODE para colorir o código!

Posted

a maneira mais simples que concheço é com o atoi();

tipo:

int i;

char str[5];

scanf ("%s", &str); ou então se preferires fgets(str,5,stdin);

i = atoi(str);

não sei se é o que queres, mas é o mais simples que conheço 👍

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.