Greetings! I am creating a C program where the user can change the state of a sensor entering the sensor name and 1 or 0 to change its status, 1 for on and 0 for off. However, when I try to check this condition out of the main, in a function is not working, I believe it is an error in the parameter passing if they can help me, I'll 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, verification does not occur.