Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- char* reverse(char*);
- int main(void) {
- char s[] = "abcdefghijklmnopqrstuvwxyz";
- printf("%s",reverse(s));
- return 0;
- }
- char* reverse(char* string){
- int length = strlen(string);
- int limit = (int)floor(length/2);
- printf("%d \n",limit);
- char temp;
- for(int x = 0;x<limit;x++){
- temp = string[x];
- string[x] = string[length-x-1];
- string[length-x-1] = temp;
- }
- return string;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement