fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void) {
  5. char txt[10];
  6. printf("%p\n", txt);
  7. printf("%p\n", &txt);
  8. scanf("%s", &txt);
  9. printf("%s\n\n", txt);
  10. char *txt2 = malloc(10);
  11. printf("%p\n", txt2);
  12. printf("%p\n", &txt2);
  13. scanf("%s", &txt2);
  14. // printf("%s", txt2); //quebra
  15. }
  16.  
  17. //https://pt.stackoverflow.com/q/251918/101
Success #stdin #stdout 0s 4572KB
stdin
teste
teste2
stdout
0x7ffc97ce075e
0x7ffc97ce075e
teste

0x559137edf280
0x7ffc97ce0750