mirror of
https://gitlab.gwdg.de/j.hahn02/university.git
synced 2026-01-01 14:54:25 -05:00
cleanup
This commit is contained in:
22
S1/GdCP/a01.c
Normal file
22
S1/GdCP/a01.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include<stdlib.h>
|
||||
#include<ctype.h>
|
||||
#include<string.h>
|
||||
|
||||
void pop(char *s, char *p) {
|
||||
int l = strlen(s) - 1;
|
||||
for (int i = p - s; i < l; i++) s[i] = s[i+1];
|
||||
s[l] = '\0';
|
||||
}
|
||||
|
||||
int strclean(char *t) {
|
||||
if (!t) return -1;
|
||||
int count = 0, ind = 0;
|
||||
while (t[ind] != '\0') {
|
||||
if (!isgraph(t[ind])) {
|
||||
pop(t, t + ind); count++;
|
||||
} else ind++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user