mirror of
https://gitlab.com/blau_araujo/cblc.git
synced 2025-05-09 18:16:37 -03:00
34 lines
487 B
C
34 lines
487 B
C
|
#include <stdio.h>
|
||
|
|
||
|
|
||
|
void print_list(char *list[]);
|
||
|
|
||
|
|
||
|
int main(void) {
|
||
|
/*
|
||
|
Os vetores de argumentos e de ambiente
|
||
|
são listas de strings terminadas com NULL:
|
||
|
|
||
|
NULL = (void *)0
|
||
|
*/
|
||
|
char *str_list[] = {
|
||
|
"banana",
|
||
|
"laranja",
|
||
|
"abacate",
|
||
|
NULL
|
||
|
};
|
||
|
|
||
|
print_list(str_list);
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|
||
|
void print_list(char *list[]) {
|
||
|
int i = 0;
|
||
|
while (list[i]) {
|
||
|
printf("[%d] => %s\n", i, list[i]);
|
||
|
i++;
|
||
|
}
|
||
|
}
|