fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void)
  5. {
  6. unsigned int m_row = 3;
  7. unsigned int m_col = 5;
  8. int** m = (int**)malloc(m_row * sizeof(int*));
  9.  
  10. for (unsigned int i = 0; i < m_row; ++i)
  11. m[i] = (int*)malloc(m_col * sizeof(int));
  12.  
  13. /* here we go with coding */
  14.  
  15. for (unsigned int i = 0; i < m_row; ++i)
  16. free(m[i]); /*obligatory memory free: step 1/2*/
  17.  
  18. free(m); /*obligatory memory free: step 2/2*/
  19.  
  20. return 0;
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'main':
prog.c:10:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
  for (unsigned int i = 0; i < m_row; ++i)
  ^
prog.c:10:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
prog.c:15:20: error: redefinition of 'i'
  for (unsigned int i = 0; i < m_row; ++i)
                    ^
prog.c:10:20: note: previous definition of 'i' was here
  for (unsigned int i = 0; i < m_row; ++i)
                    ^
prog.c:15:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
  for (unsigned int i = 0; i < m_row; ++i)
  ^
stdout
Standard output is empty