How to initialize function prototype of array with zero?

We can initialize normal function prototype's parameters with zero like this:-

void output(float = 0.0, int = 0);

or

void output(int = 0, int = 0, double = 0.0);

But how do you do the same for a pointer array or simply an array?

Assume that second parameter has to be an array.

I have tried the following and it does not work:-

1
2
3
4
5
void output(float = 0.0, int = 0);
void output(float = 0.0, *int = 0);
void output(float = 0.0, int* = 0);
void output(float = 0.0, int[] = 0);
void output(float = 0.0, int []);


But if I skip the default declarations altogether, it works.

like:

void output(float, int []);

or

void output(float, int*);

Anyone have an idea how can I do it by explicitly writing zero, just like the first cases?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>

int f(int * = 0);
int g(int[] = 0);

int main(){
	std::cout <<f()<<std::endl;
	std::cout <<g()<<std::endl;
}

int f(int *x){
	return (int)x + 1;
}

int g(int x[]){
	return f(x) + 1;
}
Topic archived. No new replies allowed.