Converting decimal integer to binary string
What about taking the trailing zero out of the loop?

while (counter &gt; 0) {

// ...

    if (counter == y) {
        bin[counter] = '\0';
    }


might look like this

bin[counter] = '\0';
--counter;

while (counter &gt; 0) {

// ...


and you don't need int y anymore.

Also --counter might be tiny bit faster than counter-- in case your optimizer is not going to help you.



As the code is not dealing with negative values I guess

char* DectoBin(unsigned dec) {


would be more appropriate.