Skip to content

Instantly share code, notes, and snippets.

@Tony363
Created December 23, 2021 15:55
Show Gist options
  • Save Tony363/cb175162f183127c090b507034972e37 to your computer and use it in GitHub Desktop.
Save Tony363/cb175162f183127c090b507034972e37 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <ctype.h>
char *findPunct(char *s)
{
char *p = s;
while (*p != '\0')
{
if (ispunct(*p))
{
return p;
}
p++;
}
return NULL;
}
int main(int argc, char **argv)
{
char *s = "Hello, World!";
char *p = findPunct(s);
if (p == s + 5)
printf("true");
else
printf("false");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment