problemas con argumentos y funciones
Publicado por Dimus (22 intervenciones) el 20/10/2002 15:33:59
Buenas.
Tengo un problema a la hora de usar los argumentos con funciones "caseras". Cuando intento compilar el siguiente programa me da un error, que es el siguiente:
In function `funcion':
12: `argc' undeclared (first use in this function)
12: (Each undeclared identifier is reported only once
12: for each function it appears in.)
13: `argv' undeclared (first use in this function)
¿como podria usar argv[0] y argc usando funcion()?
Muchas gracias a todos y un saludo.
#include <stdio.h>
void funcion(void);
int main(int argc,char *argv[])
{
funcion();
return 0;
}
void funcion(void){
printf("en total tienes %i argumentos\n",argc);
printf("y el programa se llama: %s\n",argv[0]);
}
Tengo un problema a la hora de usar los argumentos con funciones "caseras". Cuando intento compilar el siguiente programa me da un error, que es el siguiente:
In function `funcion':
12: `argc' undeclared (first use in this function)
12: (Each undeclared identifier is reported only once
12: for each function it appears in.)
13: `argv' undeclared (first use in this function)
¿como podria usar argv[0] y argc usando funcion()?
Muchas gracias a todos y un saludo.
#include <stdio.h>
void funcion(void);
int main(int argc,char *argv[])
{
funcion();
return 0;
}
void funcion(void){
printf("en total tienes %i argumentos\n",argc);
printf("y el programa se llama: %s\n",argv[0]);
}
Valora esta pregunta


0