Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int lenght(const char *s)
- {
- int count = 0;
- while(*(s+count) != '\0')
- {
- count++;
- }
- return count;
- }
- char *strconcat(const char *s, const char *t)
- {
- char buffer[lenght(s)+lenght(t)];
- for(int i = 0; i != lenght(s); i++)
- {
- buffer[i] = s[i];
- }
- for(int i = 0; i != lenght(t); i++)
- {
- buffer[lenght(s)+i] = t[i];
- printf("%d\n", i);
- }
- buffer[lenght(s)+lenght(t)] = '\0';
- return buffer;
- }
- char *strinv(const char *s)
- {
- int len = lenght(s);
- char buffer[len+1];
- for(int i = 0; i != len; i++)
- {
- buffer[len-1-i] = s[i];
- }
- buffer[len] = '\0';
- return buffer;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement