hi Forum, how can i convert items in a Array from typ Char[] in an Integer-Type? example: char data[] = "110111"; int sum = 0; sum = (int)data; or should i sum the all items in the array bitwise?
Study your C book for the chapter on strings. Note in particular the difference between a string, with a null terminator on the end, and an array of characters. Then check the library reference for sscanf(), atoi(), and strtol() / strtoul() for a few string-to-integer conversion functions already in the library. It looks like from your example that your input is in binary. C does not generally support a format for binary literals. However, the strtol() function(s) do allow you to specify the base for the conversion (base 2 to base 36). If you want to write the routine yourself, just iterate through the array, set the low bit of an int based on the current entry, and shift the int left at each step.
"It looks like from your example that your input is in binary." It looks like he intended it to be binary, but that is absolutely not what will happen!! See: http://www.keil.com/forum/docs/thread4249.asp