0

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;
}
3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by Salem
0

>> 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);

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.