Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <cstdlib>
- void posun_tablice(char *tekst, int start, int offset)
- {
- char tab[100];
- int counter = 0;
- int counter_2 = start;
- while (tekst[counter_2]!='\0')
- {
- tab[counter] = tekst[counter_2];
- counter_2++;
- counter++;
- }
- tab[counter + 1] = '\0';
- int replace_offset = start + offset;
- counter = 0;
- while (tab[counter]!='\0')
- {
- tekst[replace_offset] = tab[counter];
- counter++;
- replace_offset++;
- }
- }
- int main()
- {
- char f[100] ="Normalnynapis";
- posun_tablice(f, 4, 5);
- printf("%s", f, sizeof(f));
- //char t[100];
- //char f[100];
- //char r[100];
- //char c_to_search[5] = "asdf";
- //char text[68] = "hello my name is \0 there is some other string behind it \n\0 asdf";
- //int pos_search = 0;
- //int pos_text = 0;
- //int len_search = 4;
- //int len_text = 67;
- //for (pos_text = 0; pos_text < len_text - len_search; ++pos_text)
- //{
- // if (text[pos_text] == c_to_search[pos_search])
- // {
- // ++pos_search;
- // if (pos_search == len_search)
- // {
- // // match
- // printf("match from %d to %d\n", pos_text - len_search, pos_text);
- // system("pause");
- // return 1;
- // }
- // }
- // else
- // {
- // pos_text -= pos_search;
- // pos_search = 0;
- // }
- //}
- //// no match
- //printf("no match\n");
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement