Expand|Select|Wrap|Line Numbers
- #include<stdio.h>
- #include<ctype.h>
- main()
- {
- int c;
- /*Function converts string of hexadecimal digits to int */
- int htoi(char s[]){
- int i = 0;
- while((c == getchar()) != EOF) {
- if(isdigit(c) == '0')
- /*then*/
- {
- if(c == 'x' || c == 'X')
- /*then */
- {
- /*then test if it's a hexidecimal*/
- if(isxdigit(c))
- s[i] = c;
- i++;
- }
- else if(!isdigit(c))
- return c;
- }
- printf("Integer: %d", s);
- }/*end of for loop */
- /*End of Function */
- }
- htoi(c);
- /*End of htoi */
- }