Advertisement
Guest User

Untitled

a guest
Jun 20th, 2020
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. char **addstr(char **a, const char *s)  {
  2.    
  3.     if(s!=NULL && a!=NULL)  {
  4.         char **pa=a;
  5.         while(strcmp(*pa,""))   pa++;
  6.         a=(char**)realloc(a, (pa-a+2)*sizeof(char*));
  7.         pa=a;
  8.         while(strcmp(*pa,""))   pa++;
  9.         *(pa+1)=(char*)malloc(sizeof(char)*SIZE_CODE_LINE);
  10.         **(pa+1)='\0';
  11.         strcpy(*pa, s);
  12.         pa=NULL;
  13.     }
  14.     return a;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement