You need to add ctype.h library to use toupper function.
I checked string character by character is an alphabetic character or not thanks to ASCII values the code is here:
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
int main()
{
char line[80] = "abc dfg, egh.";
int i = 0, j;
char *last_word;
while (line[i] != '')
{
if (line[i] <= 32 && line[i + 1] > 32)
last_word = &line[i + 1];
i++;
}
i = 0;
while (last_word && last_word[i] > 32)
{
if ((last_word[i] > 64 && last_word[i] <91) || (last_word[i]> 96 && last_word[i] < 123 ))
printf("%c", toupper(last_word[i]));
i++;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…