473,396 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Error] cannot convert 'float**' to 'float*' for argument '1' to 'void fill(float*, in

#include<stdio.h>

void fill(float *av,int *max,int *i,FILE *p,int n)
{
while(!feof(p))
{
*av+=n;
if(*max<n)
*max=n;
(*i)++;
}
*av=(n)/(*i);
fclose(p);
}


the call is{
p=fopen(fn,"r");
fill(&av,&max,&i,p,n);
fclose(p);
}
the message in the description keeps popping up.I tried changing almost everything, but nothing seems to work.i'd really appreciate it if you show me your guidance,for i'm a total beginner, started a month ago!!
May 1 '15 #1

✓ answered by donbock

My guess is av is defined as an array of floats. If so, then...
  • function1(av[0]) passes a single float value.
  • function2(av) passes a single float* value that points at the first element in the array.
  • function3(&av[2]) passes a single float* value that points at the third element in the array.
  • function4(&av) passes a single float** value that points to a pointer to the first element in the array.

float* is a pointer to a float variable.
float** is a pointer to a variable which in turn is a pointer to a float variable.

Click on the Articles tab and then look at the entry named Arrays Revealed for a much more complete explanation. (I can't seem to embed a link today.)

3 10021
donbock
2,426 Expert 2GB
Please show us the definitions (types) for the variables being passed to fill when you call it.
May 1 '15 #2
donbock
2,426 Expert 2GB
My guess is av is defined as an array of floats. If so, then...
  • function1(av[0]) passes a single float value.
  • function2(av) passes a single float* value that points at the first element in the array.
  • function3(&av[2]) passes a single float* value that points at the third element in the array.
  • function4(&av) passes a single float** value that points to a pointer to the first element in the array.

float* is a pointer to a float variable.
float** is a pointer to a variable which in turn is a pointer to a float variable.

Click on the Articles tab and then look at the entry named Arrays Revealed for a much more complete explanation. (I can't seem to embed a link today.)
May 1 '15 #3
solved it
turned out that the declaration was wrong,float *av
led to the float** issue, though i didn't know what the ** was about at first,so thanks for opening my eyes on the subject.
i really appreciate it.
May 1 '15 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sorisio, Chris | last post by:
Ladies and gentlemen, I've imported some data from a MySQL database into a Python dictionary. I'm attempting to tidy up the date fields, but I'm receiving a 'mx.DateTime.Error: cannot convert...
4
by: royend | last post by:
Hi. I am having some strange troubles creating a dropdown menu at my toolbar. I have followed this tutorial: http://www.codejock.com/developer/article05.asp My problem occurs at this line:...
4
by: Pixie Songbook | last post by:
Hi, I'm trying to write a program using the Dev C++ 4.9.9.2 compiler that takes input numbers from a word document, sums them together, and then gives me a result. It should be easy as the book I...
2
by: Frostmur | last post by:
Hi !! I'm trying to convert C code to C++. This is my function: static void (*selection)(void) = NULL; static void (*pick)(GLint name) = NULL; void zprSelectionFunc(void (*f)(void))
6
by: puzzlecracker | last post by:
I call method Foo(string s); with Foo("foo"+"bar"); what's the deal here?
3
by: Arepi | last post by:
Hi, The following class decide which type is in the current instance and itialize depends on this information. The problem: When make an instance with any pointer type, a compilation error...
1
by: kyana | last post by:
can you help me with this error?'cpp cannot convert `float' to `double*' for argument #include <stdio.h> #include <stdlib.h> double f(double x,int a,int b,int c,int d); double...
1
by: roverzon | last post by:
The compiler shows the error of cannot convert float to float at line 1. I don't know what's going on about this error. It is an easy program for calculating a distance between two point ...
1
by: HenriqueMelo | last post by:
#include <iostream> #include <string.h> #include <sstream> #include <cmath> using namespace std; struct leituras{ float vetor; int n; }n1; int quadrados(leituras n1, int i, float...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.