In C, you can use the ispunct function to check if a character is punctuated.
char ch = '!'; if(ispunct(ch)) printf("punctuation"); else printf("other symbol" );