A stack ADT is dreadfully simple if you don't worry about error handling.
Code:
static char stack[BUFSIZ];
static size_t top = 0;
static void
push(char ch)
{
stack[top++] = ch;
}
static char
pop(void)
{
return stack[--top];
}
static int
isEmpty(void)
{
return top == 0;
}
As for the reverseSentence function, really all you have to do is walk down the sentence looking for punctuation. Before you find a sentence terminator, push each character on to the stack. Once you find the terminator, start popping and saving to the beginning of the sentence. You would probably need two indices. The first would be your index for pushing and searching, the second would be your index for saving the beginning of a sentence and rewriting the reversed sentence. Something like this:
Code:
pusher := string
while not end do
saver := pusher
while not end and string[pusher] != '.' do
push(string[pusher])
pusher := pusher + 1
loop
while not isEmpty() do
string[saver] := pop()
saver := saver + 1
loop
pusher := pusher + 1; # Remove '.'
while not end and isspace(string[pusher]) do
pusher := pusher + 1
loop