fork download
  1. #include <stdio.h>
  2.  
  3. void get_substr(const char *s, int m) {
  4. const char *p = s + (m - 1);
  5. while (*p != '\0') {
  6. putchar(*p);
  7. p++;
  8. }
  9. putchar('\n');
  10. }
  11.  
  12. int main() {
  13. char s[100];
  14. int m;
  15. printf("请输入字符串:");
  16. gets(s);
  17. printf("请输入起始位置m:");
  18. scanf("%d", &m);
  19.  
  20. get_substr(s, m);
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5316KB
stdin
hello
2
stdout
请输入字符串:请输入起始位置m:ello