I have the following code, but compiling error message:
"cannot convert parameter 1 from 'float' to 'float " when I call flow(v1, v2, v3, v4).

Could any one out there help me to find the problem and fix it?

Thank you!

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>

#define Length 50	

void run (float *here, float *there, float *date, float *howmuch);

struct save{
	float *here;	
	float *there;	
	float date;	
	float quant;	
} runstack[Length+1];

int n;		
int _tmain(int argc, _TCHAR* argv[])
{
    float v1 = 1;
    float v2 = 2;
    float v3 = 3;
    float v4 = 4;

    run(v1, v2, v3, v4);
    printf("%d %d %d %d \n",v1,v2,v3,v4);
    return 0;
}

void run (float *here, float *there, float *date, float *howmuch)
{
	n += 1;

	if (n > Length)
	{
		printf("Something wrong!!!");;
		exit(1);
	}
	else
	{
		runstack[n].here = here;
		runstack[n].there = there;
		runstack[n].date = *date;
		runstack[n].quant = *howmuch;
	}

	return;
}

>> run(v1, v2, v3, v4);
you are attempting to pass the variables by values instead of by reference (pointer). Put an ampersand & in front of each variable to make them pointers like this run(&v1, &v2, &v3, &v4);

> printf("%d %d %d %d \n",v1,v2,v3,v4);
Use %f for floats (and doubles), not %d

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.