fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. int main(void) {
  4. char * pt, str[]="nome.c";
  5. pt = strrchr(str, '.');
  6. printf("%s\n%s\n", str, pt);
  7. if ((pt != NULL) && (strcmp(pt, ".c") == 0))
  8. printf("É .c\n");
  9. printf("Original: %s\n", str);
  10. strcpy(pt, ".xxx");
  11. printf("Modificado: %s\n", str);
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 2160KB
stdin
Standard input is empty
stdout
nome.c
.c
É .c
Original: nome.c
Modificado: nome.xxx