redesign of alg
This commit is contained in:
parent
0664e93e2a
commit
a40d924408
|
@ -31,34 +31,32 @@ char *alloc(int n)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// def. model danych
|
||||||
|
|
||||||
//funkcja lokuje pamiec dla kazdego slowa.
|
//pre processor
|
||||||
//
|
#define LEN (8+2)*10
|
||||||
//wskaznik p1 wskazuje na pierwsza litera slowa,
|
|
||||||
//liczy ilosc slowa i alokuje pamiec dla niego.
|
struct model {
|
||||||
|
char * str;
|
||||||
|
uint32_t len ;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void alg (char *s) {
|
//func alg
|
||||||
|
//in: ptr to date
|
||||||
char count;
|
//return: count of words
|
||||||
|
int alg (const char * ptr) {
|
||||||
for (int8_t c = 0; c <= strlen(s); c++) {
|
|
||||||
|
|
||||||
if (s[c] != 0x20 && s[c] != '\0') {
|
return 1;
|
||||||
count++;
|
}
|
||||||
} else {
|
|
||||||
char *p1 = &s[++c];
|
|
||||||
alloc (count);
|
int main() {
|
||||||
count = 0;
|
|
||||||
}
|
char *str = "If wantered relation no surprise of all";
|
||||||
|
|
||||||
}
|
struct model * ptr = (struct model *) alloc (LEN);
|
||||||
}
|
|
||||||
int main() {
|
|
||||||
|
|
||||||
char *str = "If wantered relation no surprise of all";
|
|
||||||
|
|
||||||
alg(str);
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue