Advertisement
Guest User

Untitled

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