How can I get unsigned char array?

88 views Asked by At

I writing a function that will print out hexadecimal inside unsigned char array. But I can't get the size of the array. I tried using sizeof() but it seems to print out the size of the type which is 4.

if(raw_instr[0]==0x68){
    printf("%d\n",sizeof(raw_instr));
    for(int i=0; i<sizeof(raw_instr);i++){
        printf("%x ",raw_instr[i]);//expect to print 68 10 3f 0 0 but it print only 68 10 3f 0
    }
    printf("\n");
}

This is the array that I will take in for loop.

unsigned char inst1[5] = {0x68,0x10,0x3f,0x00,0x00};
0

There are 0 answers