Created
December 30, 2013 15:41
-
-
Save codingfoo/8183596 to your computer and use it in GitHub Desktop.
Example of strtol function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main() | |
{ | |
int val; | |
char str[20]; | |
strcpy(str, "0x00010"); | |
val = strtol(str, (char **) NULL, 16); | |
printf("String value = %s, Int value = %d\n", str, val); | |
return(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment