mirror of
https://gitlab.com/blau_araujo/cblc.git
synced 2025-05-09 18:16:37 -03:00
remoção do programa de exemplos
This commit is contained in:
parent
88d08cab14
commit
167e6c0751
1 changed files with 9 additions and 18 deletions
|
@ -1,33 +1,24 @@
|
|||
#include <stdio.h>
|
||||
|
||||
|
||||
void print_list(char *list[]);
|
||||
|
||||
|
||||
int main(void) {
|
||||
|
||||
/*
|
||||
Strings são vetores de caracteres terminados
|
||||
com o caractere '\0'.
|
||||
*/
|
||||
char str[] = "banana"; // O tipo de 'str' é "array of char".
|
||||
char *pstr = "cabana"; // O tipo de 'pstr' é "pointer to char".
|
||||
|
||||
|
||||
/*
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue