|
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
[Prev in Thread] | Current Thread | [Next in Thread] |