Hi i am going to make a Binary Utility but I don't knnow how to program using

extern uint16_t Bcdbin(const uint8_t* const pBcdBin)

I have already read about extern and about unsigned int but I don't understand how to make a function for that code. please help. ty

What do you know about binary coded decimal representation? That appears to be what the function's intended purpose is, which is a bigger issue than the type of pBcdBin.

But the type of pBcdBin is a pointer to zero or more bytes (that's what uin8_t represents here), where neother the pointer itself nor the bytes may be changed, they're both immutable. Technically you could simplify the function signature like so:

short BcdBin(unsigned char *pBcdBin);

This takes advantage of the fact that short int is at least 16 bits and unsigned char is at least 8 bits. The const qualifiers probably aren't necessary, but they make your life easier by enforcing immutability inside the function (ie. stop you from changing them accidentally).

Hi!. the code above is to be used to Convert a two-byte, 3-digit, BCD number into a binary value.
thank you for explaining what the function is, since I was very confused before on how or what their purpose is.
I'm afraid i have to use the above code and can't change it. :(

so a two byte BCD number is the uint16_t? do I have to put arrays to make it to a 3 Digit binary value?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.