Problem in program in C

Well, you are doing things wrong in your code, as the compiler messages tell you.

You need to fix those things first. If you get errors or warnings from the compiler, you always need to fix those first.

Here are the compiler messages from GCC:

$ gcc -std=c99 -Wall -Wextra -pedantic -O3 -o program program.c
program.c: In function ‘leituraCompras’:
program.c:94:3: warning: implicit declaration of function ‘testeValidade’ [-Wimplicit-function-declaration]
   if(testeValidade(produto,cliente,mes,unidades)==0){
   ^
program.c:67:7: warning: variable ‘tipo’ set but not used [-Wunused-but-set-variable]
  char tipo;
       ^
program.c:65:8: warning: variable ‘preco’ set but not used [-Wunused-but-set-variable]
  float preco;
        ^
program.c:56:9: warning: unused variable ‘com’ [-Wunused-variable]
  Compra com;
         ^
program.c: At top level:
program.c:140:5: warning: second argument of ‘main’ should be ‘char **’ [-Wmain]
 int main(int argc, char* argv){
     ^
program.c: In function ‘main’:
program.c:140:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
 int main(int argc, char* argv){
              ^
program.c:140:26: warning: unused parameter ‘argv’ [-Wunused-parameter]
 int main(int argc, char* argv){
                          ^
program.c: In function ‘leituraCompras’:
program.c:110:12: warning: ‘mes’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  if(mes>12 || mes<0){
            ^
program.c:69:6: note: ‘mes’ was declared here
  int mes;
      ^
program.c:114:4: warning: ‘unidades’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  if(quantidade<=0){
    ^
program.c:66:6: note: ‘unidades’ was declared here
  int unidades;
      ^
/r/learnprogramming Thread