Commit 727724f2 authored by João Denis Rodrigues's avatar João Denis Rodrigues

adicionado exemplos sobre argumentos

parent 31a07c91
#include <stdio.h>
#include <stdlib.h> //Na apostila nao tem, sem isto nao da para usar exit
void main(int count, char *parametros[]) {
if (count != 2) {
printf("Voce esqueceu de digitar o seu nome!\n");
exit(0);
}
printf ("Alo %s\n", parametros[1]);
}
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[]) {
int i;
for (i=1; i < argc; i++) {
if(system(argv[i])) {
printf("%s falha\n", argv[i]);
return -1; /* codigo de falha */
}
}
return 0; /* retorna o codigo de sucesso da operacao */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment