0
Greetings! I’m creating a C program where the user can change the state of some sensor by typing the sensor name and 1 or 0 to change the state of the sensor, being 1 for on and 0 for off. However, when I try to make this condition of checking out of main, in a function, it is not working, I believe it is some error in passing parameters, if you can help me, I will put the code below.
#include<stdio.h>
#include<string.h>
char y[2];
int sensor;
int s1;
char s[2];
void verificar(char y[2], int sensor);
void main ()
{
printf("Digite o sensor que deseja alterar o estado\n");
gets(s);
printf("Ligar ou desligar? (1 ou 0)\n");
scanf("%d", &s1);
void verificar(s, s1);
}
void verificar(char y[2], int sensor)
{
if(strcmp(y,"s1")==0 && (s1 == 1))
{
printf("S1 ligado");
}
}
When I try to run the program, the check does not occur.
calling the function is only with the name:
verificar(s, s1);
without thevoid
– Isac