Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- void invert(char sentence[]) {
- int sentenceLenght = strlen(setning);
- char sentenceInverted[setningLenght];
- for(int i = 0; i < sentenceLenght; i++)
- {
- for(int j = sentenceLenght; j > 0; j--)
- {
- sentenceInverted[i] = sentence[j];
- }
- }
- printf("n%s", sentenceInverted);
- }
- int main()
- {
- char sentence[100];
- printf("Write in a sentence: ");
- scanf("%s", sentence);
- invert(sentence);
- }
Add Comment
Please, Sign In to add comment