online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include<time.h> #include<stdlib.h> #include<stdio.h> int maior; int comparador; int i = 0; int quant; int count = 0; int* CriarVetor(int tamVetor){ int a = 1; int *vetorElementos = malloc(sizeof(int *) * a); srand(time(NULL)); vetorElementos = realloc(vetorElementos, sizeof(int *) * tamVetor); for (int i = 0; i < tamVetor; i++) { vetorElementos[i] = rand() % 100; } return vetorElementos; } int AcharElemento(int *vetorElementos){ maior = vetorElementos[0]; printf("recebi o vetor, seu primeiro elemento e %d\n", maior); comparador = vetorElementos[i]; printf("vetorElementos[i] e %d\n", comparador); /* if (i == quant) { return maior; } else { if (comparador > maior) { printf("entrou no if de comparacao e %d\n",comparador); maior = comparador; } i++; AcharElemento(&vetorElementos); } */ return maior; } int main(){ printf("Entre a quantidade de Elementos desejada\n"); //scanf("%d", &quant); quant = 3; int *elementos = CriarVetor(quant); printf("Os elementos do vetor sao:{"); for (int i = 0; i < quant; i++) { printf("%d,", elementos[i]); } printf("}\n"); /* Encontrar o maior numero dentro do vetor */ int result = AcharElemento(elementos); printf("Maior Elemento e: %d\n", result); free(elementos); }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue