Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // apple xcode
- // paulogp
- /* char2int */
- #include <stdio.h>
- #include <stdlib.h>
- int main (int argc, const char * argv[])
- {
- char the_char_vector[3] = {'2', '3', '4'};
- int the_num, i;
- long the_merge_num;
- // char 2 int
- for (i = 0; i < 3; i++)
- {
- the_num = the_char_vector[i] - '0';
- printf("%i: %i\n", (i + 1), the_num);
- }
- // get all as one number
- the_merge_num = strtol(the_char_vector, NULL, 0);
- printf("tudo: %li\n", the_merge_num);
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement