First: main()returns an int not a void. main() returning void was an old Microsoft goof-up that they have been trying to eradicate ever since.
Second: This code
void main()
{
const int f(int );
etc...
This is a function prototype:
const int f(int);
because the function returns a copy of an int. This const int can be assigned to either a const or non-const variable:
int x = f(3); //OK
const int y = f(4); //Also OK
so having the return be const is irrelevant. It is ignored by the compiler and also produces a warning.
In general terms, if the function returns a type then having the return be const is ignored and produces a warning.
The above is not true in the case of the function returning a pointer. There the const is important since it describes whether the value pointed at by the pointer is changeable or not. Returning a pointer is a separate case since a pointer is not a type. Rather, it is an address.
Third:
int a = f(&b);
won't compile becuse the function prototype shows an int argument and not an int*.
Fourth:
Doubt 2 : int the main , I declared const int a[2] = { 1, 2}; sending f(&a[1])
o/p its reflecting in the main function why?
You are passing the address of a variable to the function. The function is changing the variable at that address. Hence, you variable in main() got changed.
BTW: Where is const int a[2] = { 1, 2}; ???