C error in conflicting types -


#define rand_max 10 #include<stdio.h> int main() {   double x;   x=randrange(-1.0,1.0);   printf("x value %f::",x);   return 0; }  double randrange(double min, double max) {   return rand() * (max - min) / rand_max + min; } 

error::the snippet below error being generated--

$gcc main.c -o demo -lm -pthread -lgmp -lreadline 2>&1 main.c:11:8: error: conflicting types 'randrange' double randrange(double min, double max) { ^ main.c:6:5: note: previous implicit declaration of 'randrange' here x=randrange(-1.0,1.0); ^ 

error in conflicting types??i have checked return types.

you need declare function above point called.

double randrange(double min, double max);  int main() {     double x;     x=randrange(-1.0,1.0);     ...  double randrange(double min, double max) { 

if don't, ansi c gives implicit declaration function returning int


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -