Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdint.h>
- char* make_name_short(char* name) {
- uint8_t i = 1;
- uint8_t n = 1;
- static char compact_name[250];
- compact_name[0] = name[0];
- while (name[i] != '\0') {
- if (name[i] != name[i - 1]) {
- compact_name[n] = name[i];
- n++;
- }
- i++;
- }
- compact_name[n] = '\0';
- return compact_name;
- }
- void main() {
- char* name;
- name = make_name_short("boooooobapalaxxxxios");
- printf("%s", name);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement