Advertisement
B1KMusic

Palindrome thingy

Jul 12th, 2016
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. // I...got a little carried away...
  2.  
  3. #include <stdio.h>
  4.  
  5. void modify_buffer(char *buffer){
  6.     int i = 1;
  7.  
  8.     while(*buffer){
  9.         *buffer += ++i * strlen(buffer);
  10.         *buffer = ((*buffer - 'A') % 26) + 'A';
  11.         buffer++;
  12.     }
  13. }
  14.  
  15. int main(){
  16.     char buffer[10] = "ABCDEFG";
  17.     char buffer2[10] = "ABCDEFGH";
  18.  
  19.     modify_buffer(buffer);
  20.     modify_buffer(buffer2);
  21.  
  22.     printf("Buffer: %s\n", buffer); // OTWXWTO
  23.     printf("Buffer2: %s\n", buffer2); // QWACCAWQ
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement