大厂笔试题
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
442 B

  1. /*
  2. */
  3. #include<stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. void get2(char *p){
  7. // char *aa;
  8. // memcpy(aa, "bbb", 3);
  9. // p = aa;
  10. // p = (char *)malloc(10);
  11. *p = 'c';
  12. }
  13. int main(){
  14. char *m;
  15. memcpy(m, "aaa", 3);
  16. get2(m);
  17. for(int i = 0; i < 300; i++){
  18. char tmp = *(m + i);
  19. if(tmp == '\0')break;
  20. printf("%c", *(m + i));
  21. }
  22. return 0;
  23. }