Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int ReverseStrings(char buffer[])
- {
- int check = -1;
- int i = 0;
- while (buffer[i] != '\0' && check)
- {
- if (!((buffer[i] >= 'a' && buffer[i] <= 'z') || (buffer[i] >= 'A' && buffer[i] <= 'Z') || (buffer[i] == ',')))
- check = 0;
- i++;
- }
- if (check)
- {
- int length = i + 1;
- int j = i; // length of array
- int temp;
- i = 0;
- while (buffer[i] < length / 2 && j > length / 2)
- {
- temp = buffer[i];
- buffer[i] = buffer[j];
- buffer[j] = temp;
- j--;
- i++;
- }
- check = -1;
- printf("%s", buffer);
- }
- return check;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement