Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #2612

    Hello everyone
    I state that while using a few years and therefore the Arduino “C” I always confusing for (It will age…). Then the problem (!!) and this:
    I define an array: byte array[8] = {0,0,0,0,0,0,0,0};
    Then in the sketch context of each array element can have different values.
    A specific function using this array, however, not declared in the construct but directly inside like this simplistic example:
    byte output (byte idx)
    { return (array[idx] ); } ;

    The function returns the value pointed to by the array idx.
    So far nothing to complain: But the problem is: how do I go in the function’ ADDRESS array so that the same function can “TO SEE” different arrays ? . I tried various examples of pointers but have not come with the problem. (It will be the old age…….)
    Thanks for any suggestions Vs.……


    If you declare an array variable

    byte array[] = {0,0,0,0,0,0,0,0};
    int addr = *byte;

    It is noted that the addr variable must be 16 bit as obvious are the addresses. With the asterisk is obtained with the pointer variable. So there are maneuvers that with the post-increment can be read the next value.
    Clearly the situation is very complex and I fall too with some errors.
    The reference guide is who
    The aim in general to use the pointers are in avoid making the crossings transit variables for functions that are questioned. Saying to make use of the pointer is said therefore to load the value directly into the designated variable.
    If you are looking to move to a different array, still it needs to know its address. For this it makes the statement with an asterisk in front.


    I believe that there is some error on the link “WHO” does not work


    Then it will be who 😀

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.