Advertisement
Guest User

Func

a guest
Apr 16th, 2023
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. int untag (char* str,int n);
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6.     char* t=(char*)"<int>  45<\int>";
  7.  
  8.     int rv=untag(t,14);
  9.     printf("\n%d",rv);
  10. }
  11.  
  12. int untag (char* str, int n)
  13. {
  14.     int i,j=0,k;
  15.     char a[15];
  16.     for (i=0;i<n;i++)
  17.     {
  18.      if (str[i]=='<')
  19.      {
  20.         while (str[i]!='>')
  21.           i++;
  22.      }
  23.      else if (str[i]==' ')
  24.       i++;
  25.      else
  26.       a[j++]=str[i];
  27.     }
  28.     a[j]=(char)0;
  29.     //printf("%s",a);
  30.     k=atoi(a);
  31.     //printf("%d",k);
  32.      return  k;
  33.    
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement