Tema: Sobre argv
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 28/09/2014, 09:37
ivan_esp
 
Fecha de Ingreso: diciembre-2012
Mensajes: 26
Antigüedad: 11 años, 4 meses
Puntos: 0
Respuesta: Sobre argv

Tengo esto:
Código C:
Ver original
  1. #include <stdio.h>
  2.  
  3. int main(int argc, char *argv[]) {
  4.  
  5.      int i=1;
  6.      char e;
  7.      for(i=1;i<argc;i++){
  8.      e=argv[i][1];
  9.     // printf("%c\n",argv[i][1]);
  10.      if(e=="c")
  11.       printf("Argumento %d es Compilar \n",i);
  12.      if(e=="E")
  13.       printf("Argumento %d es Preprocesar \n",i);
  14.      
  15.        
  16.      }
  17.  
  18.      
  19. }

Pero me da error al compilar:

Código BASH:
Ver original
  1. opciones.c: In function ‘main’:
  2. opciones.c:10:10: warning: comparison between pointer and integer [enabled by default]
  3.       if(e=="c")
  4.           ^
  5. opciones.c:12:10: warning: comparison between pointer and integer [enabled by default]
  6.       if(e=="E")
  7.           ^