You have an off by one error indeed: the call

reverse(st+i,j-1);


should be

reverse(st+i,j-i-1);


Your code passes j-1 which is the length from the beginning of the string to the position of the last space; it should be the length of the last word, so you need to subtract the index of the first character (i.e. i).

You are also not reversing the last word (see the other answer for the details on that).

Bug in my C code to reverse words in a string
I am using openOCD in eclipse for the arm STM32F10x series. After writing the whole code and  building everything without error in the program, I am going to debug it and I am getting an error after completion of 99% of the process. The following error is generated and I am not able to debug my program. 

Error in final launch sequence
Failed to execute MI command:  
-exec-run
Error message from debugger back end:
Error creating process

