array of chars to int or bcd

I'm trying to get an array of chars converted to an in or bcd eg. ['1','0','0'] to 100. I could get it if I could find the size of a mutable array, but am open for any way that works ( with mutable arrays if possible). Thanks, Isaac

If the "array of chars" is a string (i.e. it is NULL terminated), the atoi function will return an int, given the array of chars.

I could get it if I could find the size of a mutable array

What do [u]you[/u] mean by mutable arrays? Where is the data in the array coming from? Is it, or is it not, NULL terminated? Why can't you find the size of the array at some point in your code?

Thanks, next time I’ll look at the avrgcc documentation too :slight_smile: . Now, to make it into a cpp library :-X.

I could get it if I could find the size of a mutable array

You don't get mutable arrays as such in this language, all arrays are mutable. An array is simply the number of variables times the size in bytes of each variable.

Unless one uses the 'const' keyword, as for example "const int array[] = { 0, 1, 2, 3 };", arrays are mutable.

EDIT: But in this case being mutable is not the same as being able to add entries in order to expand the size of an array.

Thanks for all the tips, I'm new to c/cpp. I have done a little amount of development on the Mac with objective c, so cpp is confusing for me. I'm figuring it out, though.