fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. typedef struct {
  6. int numero;
  7. } Estrutura;
  8.  
  9. int main(int argc, char *argv[]){
  10. Estrutura *i = malloc(sizeof(Estrutura));
  11. Estrutura *d = malloc(sizeof(Estrutura));
  12. i->numero = 5;
  13. memcpy(d, i, sizeof(Estrutura));
  14. i->numero = 6;
  15. printf("%d", d->numero);
  16. printf("%d", i->numero);
  17. }
  18.  
  19. //https://pt.stackoverflow.com/q/450547/101
Success #stdin #stdout 0s 4396KB
stdin
Standard input is empty
stdout
56