fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void hoge(const char *p)
  5. {
  6. int i;
  7.  
  8. for (i = strlen(p) - 1; 0 <= i; i--) {
  9. if (p[i] == '.') break;
  10. }
  11. printf("%s=%d\n", p, i);
  12. }
  13.  
  14. int main()
  15. {
  16. hoge("a.c");
  17. hoge("abc");
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.02s 2724KB
stdin
Standard input is empty
stdout
a.c=1
abc=-1