Arrays as hidden pointers are passed by address - C Function

C examples for Function:Function Parameter

Description

Arrays as hidden pointers are passed by address

Demo Code

#include <stdio.h>
void set(int a[]) { a[0] = 1; }

int main(void) {
  int x[] = { 0 };
  set(x);/*from   ww  w . j  a  va2s  .  c o  m*/
  printf("%d", x[0]); /* "1" */
}

Related Tutorials