Last active
May 7, 2020 22:33
-
-
Save whb07/94740f9ac5996b5762c429ad2c6a395a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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