Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stddef.h>
- #include <stdint.h>
- #include <string.h>
- #include <stdio.h>
- int strrev(uint8_t* source, uint8_t* destination){
- uint8_t *end, *dst;
- destination += strlen(source);
- while (*source) {
- end = source;
- do {
- destination--;
- end++;
- } while (*end && 0x80 == (*end & 0xC0));
- for (dst = destination; source < end; ++dst, ++source) {
- *dst = *source;
- }
- }
- }
- int main() {
- char text[] = "Тест перевернутой строки!";
- char result[sizeof(text)];
- result[strlen(text)] = 0;
- for (int i = 0; i<1000000; i++) {
- strrev(text, result);
- }
- printf("Result: %s", result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement