This commit is contained in:
mpabi 2024-05-26 07:41:50 +00:00
parent d9e57e8ca0
commit 7bf09994cf
3 changed files with 18 additions and 8 deletions

View File

@ -1,4 +1,5 @@
#include <stdint.h>
#include "myfunc.h"
int strlen(char *s) {
char *p = s;
@ -51,12 +52,6 @@ char *alloc(int n)
//pre processor
#define LEN (8+2)*10
struct model {
char * ptr;
uint32_t len ;
};
//alg
// prosta implementacji func. z bibl. std. strok przy uzyciu gpt3.5
//

View File

@ -1,4 +1,17 @@
#include "myfunc.h"
#include <cstring>
int strncmp(const char* s1, const char* s2, size_t n) {
for (size_t i = 0; i < n; i++) {
if (s1[i] != s2[i]) {
return (unsigned char)s1[i] - (unsigned char)s2[i];
}
if (s1[i] == '\0' || s2[i] == '\0') {
break;
}
}
return 0;
}
bool compareWords(const char* a, int lenA, const char* b, int lenB) {
int minLen = (lenA < lenB) ? lenA : lenB;

View File

@ -3,7 +3,9 @@
#include <stdint.h>
void count_characters(const char* alfabet, const char* slowo, uint8_t* wynik);
struct model {
char * ptr;
uint32_t len ;
};
#endif