Ir para conteúdo
Fórum Script Brasil

Gustavo Cruz

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre Gustavo Cruz

Gustavo Cruz's Achievements

0

Reputação

  1. Pessoal, boa tarde . Sou iniciante em linguagem C, e por isso estou com dificuldades pra conseguir identificar o erro. Me digam por favor o que está errado nesse código, e me digam como resolver!! CÓDIGO: #include <stdio.h> #include <stdlib.h> int i; int vetor1 [5]; int vetor2 [5]; int vetor3 [5]; float total = 0; void mediaVetores (int *vetor3, int tamanho, float total = 0){ for (int i = 0; i < tamanho; i++){ vetor3 = (vetor1 + vetor2); total = total + vetor3; } total = total/tamanho; printf ("\nA média dos dois vetores é: \n\n%.2f\n", total); } int main() { printf ("\n Digite os valores do primeiro vetor: \n\n"); for (int i = 0; i < 5; i++){ scanf ("%d", &vetor1); } printf ("\n Digite os valores do segundo vetor: \n\n"); for (int i = 0; i < 5; i++){ scanf ("%d", &vetor2); } mediaVetores (total); } ERROS QUE O REPL.IT INFORMA: exit status 1 main.c:11:58: error: expected ';', ',' or ')' before '=' token void mediaVetores (int *vetor3, int tamanho, float total = 0){ ^ main.c: In function 'main': main.c:43:5: warning: implicit declaration of function 'mediaVetores' [-Wimplicit-function-declaration] mediaVetores (total); ^~~~~~~~~~~~
×
×
  • Criar Novo...