[Solved] Trying to reverse a string using c [duplicate]


#include <stdio.h>
#include <ctype.h>
#include <conio.h> //for getch()

int main(){
    char str[100];
    char final[100];
    char temp[100];
    int i, j, k;

    printf("Enter the string :");
    scanf("%99[^\n]", str);

    printf("\n%s\n", str);

    for(k=j=i=0;;++i){
        if(isspace(str[i]) || str[i]=='\0'){
            while(k){
                final[j++] = temp[--k];
            }
            if('\0' == (final[j++] = str[i]))
                break;
            //k=0;
        } else {
            temp[k++] = tolower(str[i]);
        }
    }

    printf("%s\n", final);     

    getch();
    return 0;
}

1

solved Trying to reverse a string using c [duplicate]