fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void print_array_size_3( int (*a)[ 3 ] ) {
  5. printf( "total size: %zu, first element is: %d\n", sizeof(*a), (*a)[ 0 ] );
  6. }
  7.  
  8. void print_array_size_5( int (*a)[ 5 ] ) {
  9. printf( "total size: %zu, first element is: %d\n", sizeof(*a), (*a)[ 0 ] );
  10. }
  11.  
  12. int main() {
  13.  
  14. int a[] = { 2, 4, 6 };
  15. int b[] = { 7, 8, 9, 10, 11 };
  16.  
  17. print_array_size_3( &a );
  18. print_array_size_5( &b );
  19.  
  20. return EXIT_SUCCESS;
  21. }
Success #stdin #stdout 0.01s 1676KB
stdin
Standard input is empty
stdout
total size: 12, first element is: 2
total size: 20, first element is: 7