#Binary C Track

29 messages · Page 1 of 1 (latest)

fossil robin
#

Hello i want to make this exercise. But first i dont know how to make an int from a string

rotund zephyr
#

Which track? What have you tried so far?

fossil robin
#

because first i have to use an int

#

I don't see how I can convert directly from a string.

#

i have a doubt

#

i make this

#

for the moment

#

I think it makes more sense to use an integer rather than a string.

rotund zephyr
#

In general please share codeblocks, not images. For example, you can type the following. Note, the ``` must be on their own line.
```
for number in range(10):
total += number;
```
Discord will render that as so:

for number in range(10):
    total += number;

Click here to learn more about codeblocks: https://exercism.org/docs/community/being-a-good-community-member/writing-support-requests and http://bit.ly/howto-ask

Exercism

Want help? Help yourself by learning how to write a good support request!

Do you often get ignored when you ask people online to help you with your coding problems? Make sure you're not breaking any of those 7 rules.

fossil robin
#

Thank you for this

#

int convert(const char *input){
    if(!convert) return NULL;

    


}```
rotund zephyr
#

But more importantly what track is this for? Exercism offers 77 tracks so letting us know which one you’re working on will help us help you.

fossil robin
#

Its C track

rotund zephyr
tulip storm
#

The instructions say to do it from first principles. How would you convert that by hand using only paper and pencil?

fossil robin
#

Binary C Track

fossil robin
#

But i dont know how to do this in C with a string

tulip storm
#

Which part of the conversion are you having trouble with?

fossil robin
#

we have a string but its an array

tulip storm
#

Yes. That's how C strings work 😉 A string is a series (array) of characters.

fossil robin
#

I have to write a C program that converts a binary string into a decimal number. To do that, I’ll first check if the string only contains '0' and '1', and then I’ll use the position of each bit to compute its corresponding power of 2 and add it to the result.

tulip storm
#

Sounds like a plan. For bonus points, try to solve it without doing any exponent operators 🙂