Branch
Hash :
94046104
Author :
Thomas de Grivel
Date :
2020-02-24T15:19:27
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#include"nieme_str.h"
char * nieme_str(char * str, int n)
{
char * ch;
int i,p;
i=0;
ch=malloc(strlen(str)*sizeof(char));
if(str==NULL) {
return str;
} else {
while( n>0 ) {
if( str[i]=='#') {
n--;
}
i++;
}
p=0;
while( str[i]!='#' ) {
ch[p]=str[i];
p++;
i++;
}
ch[p]='\0';
realloc(ch, (p+1)*sizeof(char));
return ch;
}
}