Friday, January 3, 2014

Passing two dimensional array

#include
#include

foo(char in[][10]){
char *a = "Hello";
char *b = "Helle";

memcpy(in[0],a,strlen(a)+1);
memcpy(in[1],b,strlen(b)+1);
}


int main(int argc, char *argv[]){
char var[2][10];

  foo(var);
  printf("out: %s %s \n", var[0], var[1]);
 
    return(0);
}

No comments:

Post a Comment