eh**********@gmail.com writes:
When I rename the variables d,p TO : do,po in all the module of :
void convert_meter(float *me,float *d,float *p)
I got an error of that line of : void convert_meter(float *me,float
*d,float *p)
E:\programs\c_lang\iti01\tc201\ch05\own>tcc pnt02o04
Turbo C Version 2.01 Copyright (c) 1987, 1988 Borland International
pnt02o04.c:
Error pnt02o04.c 44: Declaration syntax error
*** 1 errors in Compile ***
Available memory 396264
Others have already answered your question, but I have some comments
on your code.
>
#include "stdio.h"
void main()
main returns int. Change this to
int main(void)
{
float meter,dots,points;
Using float is ok, but in most cases double makes more sense. double
provides more range and precision than float, and it's typically not
much more expensive. The only good reason to use float rather than
double is to save space in large arrays, and then only if it's worth
the reduced precision. (If you use double rather than float, you'll
need to change the format strings for printf() and scanf().)
void input_meter();
void convert_meter();
char another();
The empty parentheses mean that the functions take an unspecified (but
fixed) number and type of arguments. There's no reason not tell the
compiler exactly what these functions expect:
void input_meter(float *me);
void convert_meter(float *me,float *d,float *p);
char another(void);
[snip]
void input_meter(float *me)
{
printf("\nEnter size in meter : ");
scanf("%f",me);
}
This might be cleaner as a function returning float (or double).
void convert_meter(float *me,float *d,float *p)
{
*d=((*me)*300)/(0.0254);
*p=((*me)*720)/(0.0254);
printf("\n %f Meter is = %f dots %f points",*me,*d,*p);
}
Why is the first argument a pointer? You can just pass the
floating-point value directly.
[snip]
Finally, indentation is your friend. If you indented the code using
tab characters, they may have been lost when you posted it. If you
didn't indent it at all, you really should.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.