C function prototype: void f(). Is it recommended?
Posted
by ycalleecharan
on Stack Overflow
See other posts from Stack Overflow
or by ycalleecharan
Published on 2010-04-04T09:55:51Z
Indexed on
2010/04/04
10:03 UTC
Read the original article
Hit count: 214
c
Hi,
I'm learning C and I saw in a book that a function prototype has the form void f() and in the function declaration or in the calling function, the f function takes arguments.
Thus In the function declaration we have something like void f(long double y[], long double A) and in the calling function is f(y, A).
The function is doing operations on the array y i.e. when the function is called, some elements in the array y are changing. A is just a constant numerical value that doesn't change. I have two questions:
If defining the function prototype at the top in the program as void f() a good practice? Or is it better to put it as void f(long double y[], long double A) as in the function declaration?
The called function f is changing elements in the array y. Is void the right return type? The program is working fine as such with the void as described.
Or should I change all my "voids" to "long double".
I'm working with long double as I need as much precision as possible though on my machine both double and long double gives me 15 precision digits.
Thanks a lot
© Stack Overflow or respective owner