Skip to content

Instantly share code, notes, and snippets.

@whb07
Last active May 7, 2020 22:33
Show Gist options
  • Save whb07/94740f9ac5996b5762c429ad2c6a395a to your computer and use it in GitHub Desktop.
Save whb07/94740f9ac5996b5762c429ad2c6a395a to your computer and use it in GitHub Desktop.
// Allowed manner of interacting with arrays
// where returning an array by value from a function isn't allowed
unsigned char buffer[10];
// pass in a pointer to the initialized array you want to mutate
void hiBuffer(unsigned char *buff){
buff[0] = 'h';
buff[1] = 'i';
};
// But returning by value a struct is allowed...!
struct Person { int age;};
struct Person getThirtyYo(void){
struct Person p = {30};
return p;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment