So I have a task to write a function "mult" with variable number of arguments using pointers. And this function must calculate the product of float numbers.
I've followed the guide that our uni gave us but my product is still equal to zero. I found out that the problem is that every other number to be multiplied is zero.
#include <iostream>
using namespace std;
int mult(int k,...){
int* p = &k;
int m = 1;
for(; k != 0; k--){
m *= *(++p);
}
return m;
}
int main(){
float res1 = mult(11,45,10,9,8,7,6,5,4,3,2,2);
float res2 = mult(7,12,23,0.3,0.6,1,2);
float res3 = mult(3,0.6,-12,-0.9);
cout << "Your results are:\n"
<<res1<<"\n"
<<res2<<"\n"
<<res3<<"\n";
return 0;
}

Here's examples from guide:
void Print_stor(int k, ...)
{
int n=k;
int a[n];
int *p = &k;
for ( ; k!=0;k--)
a[k-1]=*(++p);
for(int i=n-1; i>=0; i--)
printf("%i ", a[i]);
printf("\n");
}
int sum(int k, …)
{
int *p = &k;
int s=0;
for ( ; k!=0; k--)
s+=*(++p);
return s;