int foo(unsigned char * ptr, int len){ ....}void foo2(void){ int x; int offset; x = foo(msg[!msg_lock][offset], sizeof(msg)-offset ); .... }