I have a problem with reading an array that produces the error
Segmentation Fault (core dumped)
This is just the beginning of code development, but it already has an error after reading the first element of array .
#include <stdio.h>
#include <stdlib.h>
void LerArray( int numElementos , float * elemArray ){
int i;
float num ;
for( i = 0 ; i < numElementos ; i++ ){
printf("Digite um numero para seu array: ");
scanf("%f", num );
*( elemArray + i ) = num ;
printf("/n/n");
}
}
int main (){
int numElementos;
printf("Oi !!! Quantos elementos vc quer armazenar : ");
scanf("%d", &numElementos );
system("clear");
float * vetorNum ;
vetorNum = ( float * ) malloc( numElementos );
LerArray( numElementos , vetorNum );
return 0 ;
}