fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. typedef struct {
  5. size_t tamanho;
  6. int conteudo[];
  7. } Conjunto;
  8.  
  9. int main(void) {
  10. Conjunto *dados = malloc(sizeof(Conjunto) + 10 * sizeof(int));
  11. dados->tamanho = 10;
  12. for (int i = 0; i < dados->tamanho; i++) dados->conteudo[i] = i;
  13. for (int i = 0; i < dados->tamanho; i++) printf("%d, ", dados->conteudo[i]);
  14. }
  15.  
  16. //https://pt.stackoverflow.com/q/373428/101
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,