How to access environment or service variables from C application

What is the best way to access Balena Environment and/or Service variables from a C application running inside a docker container? I see that Balena offers SDK for Python and Javascript that have this functionality, but not for C. Standard C getenv() call returns a null, for both Service and Environment variables. Any ideas???

Hey there! Not sure why getenv() would return null. Do you see the env vars you are expecting if you execute the env command in the containers through the shell?

Sorry, my error, getenv() does work! I was printf’ing the string with %S instead of proper %s (lower case)