如何从C中的函数内部访问unsigned char数组?

use*_*649 1 c arrays pointers

我试图从函数readfile访问名为buf的缓冲区.当我打印sizeof(buf)时,我看到buf有4个字节(指针).另一方面,如果我在readFiles上粘贴printf命令,我可以看到大小是2916.实际上,我不明白为什么它不是729,但很明显我无法访问readfile里面的buf我需要.所以问题是; 问题在哪里以及如何纠正?

void readfiles(FILES * files){
    unsigned char * buf [1*729];
    int skip_lines = 14;
    int shift = 0;
    char * filename = "file.txt";
    // printf("buf size %d", sizeof(buf));
    readfile(filename, skip_lines, buf, shift);
}
int readfile(char * name, int skip, unsigned char * buf, int shift ){
 // buf is (unsigned char *) on address 0x22dd18 ""
    printf("buf size %d", sizeof(buf));
}
Run Code Online (Sandbox Code Playgroud)

pm1*_*100 5

如果将数组作为指针传递给C函数,则无法检测其长度.

int readfile(char * name, int skip, unsigned char * buf, int shift ){
// nothing you do in here can tell how big buf is
}
Run Code Online (Sandbox Code Playgroud)

如果你需要知道buf的长度,你必须将其作为参数传递

int readfile(char * name, int skip, unsigned char * buf,int blen, int shift ){
...
}
Run Code Online (Sandbox Code Playgroud)