Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdint.h>
- void print_nultstr(const char* envstr[], const char* envstr_name){
- uint32_t i;
- const char* tstr;
- if(envstr == NULL || envstr_name == NULL){
- return;
- }
- i = 0;
- tstr = envstr[0]; // Might be unsafe
- do{
- printf("%s[%d]: %s\n", envstr_name, i, tstr);
- ++i;
- tstr = envstr[i];
- }while(tstr != NULL);
- }
- int main(int argc, const char * argv[], const char* envp[], const char* apple[]) {
- print_nultstr(argv, "argv");
- print_nultstr(envp, "envp");
- print_nultstr(apple, "apple");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement