After spending the last two days on reading on pointers, i've made several attempts to use them. Although the concept seems simple, i miss something here. Here's the simple code i'm trying:
... uint8_t StrLength (char *a) { return strlen(a); } main (void) { char *a = "abcded"; ioinit (); while(1) { blink(0); blink(1); blink(StrLength(a)); blink(strlen(a)); } }
blink(n) lets a led blink n-times. I've tried several lengths of string a. In all cases strlen gives the right length, but StrLength gives:
String lenght: 1 2 3 4 5 6
Returns:____ 2 4 4 6 6 8
I apologize if this is really newbee, but i'm stuck and have no clue. Thanks in advance for giving one.
Leon
BTW: (atmega 48, STK500, avr-gcc 4.3.0, avrdude)