0

theoretically - when using unint16_t (unsigned integer of size 16) I have two arrays of these unsigned int and i am going to use

memcmp

for example:

uint16_t a[ARRAYSIZE] = {0,1,2,3,4,5,6,7,8,9,10};
uint16_t b[ARRAYSIZE] = {0,1,2,3,4,5,6,7,8,9,10};

if (memcmp(a,b , sizeof(uint16_t) * 16) == 0)
    {
        return true;
    }else
    {
        return false;
    }

My really question is do i need to use strcpy?? am i going down the correct path or is there an alternitive to using it ?

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Ancient Dragon
0

>>sizeof(uint16_t) * 16
Wrong. All that gives you is the number of bits (not bytes) in one integer. what you want is the size of one of the arrays, such as ARRAYSIZE*sizeof(uint16_t) >> do i need to use strcpy
No. strcpy() works on strings of text data, not numeric data.

Edited by Ancient Dragon: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.