Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. #include <ctype.h>
  2. int checkIfInt(char input[]){
  3.     int i=0;
  4.     char c;
  5.  
  6.     while((c=input[i])!='\0'){ //ficnhé non arrivato a terminazione della stringa
  7.         if(!isdigit(c)){
  8.             return -1;
  9.         }
  10.         i++;
  11.     }
  12.     return atoi(input);
  13.  
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement