fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. struct myStruct {
  5. int a;
  6. int b;
  7. int c;
  8. };
  9.  
  10. struct myStruct * initialize( int size ) {
  11. return malloc( size * sizeof( struct myStruct ) );
  12. }
  13.  
  14. void operations( struct myStruct * myArray ) {
  15. myArray[1].a = 7;
  16. }
  17.  
  18. int main( ){
  19.  
  20. struct myStruct * myArray;
  21.  
  22. myArray = initialize( 2 );
  23. operations( myArray );
  24.  
  25. printf( "%d", myArray[1].a );
  26. free( myArray );
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 2424KB
stdin
Standard input is empty
stdout
7