avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] How to pass an array to founction


From: James Hamilton
Subject: Re: [avr-gcc-list] How to pass an array to founction
Date: Tue, 24 Dec 2013 12:47:14 -0500

Something like this:

void compute(char *a, int aLen) { // could also be "unsigned int aLen"

  if (a == NULL || aLen < 1) {
    // error
    return;
  }

  a[0] = 'A';

  // make sure to check the length of the array before referencing deeper into it
  ...
  ...
}

char arr[20];
compute(arr, 20);

...

Good luck!

~James


reply via email to

[Prev in Thread] Current Thread [Next in Thread]