Skip to main content
Add info about strtok()
Source Link
Fauzan
  • 375
  • 1
  • 8

How about

char array[5] = "T 20";
int num = atoi(array+2);

This obviously assumes that all your strings are of the same format "A NN". If not, you can try parsing it using strtok(). See this excellent answer.

How about

char array[5] = "T 20";
int num = atoi(array+2);

This obviously assumes that all your strings are of the same format "A NN"

How about

char array[5] = "T 20";
int num = atoi(array+2);

This obviously assumes that all your strings are of the same format "A NN". If not, you can try parsing it using strtok(). See this excellent answer.

Source Link
Fauzan
  • 375
  • 1
  • 8

How about

char array[5] = "T 20";
int num = atoi(array+2);

This obviously assumes that all your strings are of the same format "A NN"