473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

error when rename pointer names

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
#include "stdio.h"

void main()
{
float meter,dots,points;
void input_meter();
void convert_meter();
char another();
do {
input_meter(&meter);
convert_meter(&meter,&dots,&points);
} while (another()=='y');
}
void input_meter(float *me)
{
printf("\nEnter size in meter : ");
scanf("%f",me);
}

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);
}
char another()
{
char ans;
printf("\n\n Do you want to procees (y/n) : ");
scanf("\n");
scanf("%c",&ans);
return ans;
}

Jul 17 '06 #1
3 1811
ehabaziz2...@gmail.com wrote:
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)
What happens when you rename d to while?
What happens when you rename d to for?

Hint:
do {
input_meter(&meter);
convert_meter(&meter,&dots,&points);
} while (another()=='y');
--
Peter

Jul 17 '06 #2

eh**********@gmail.com wrote:
When I rename the variables d,p TO : do,po in all the module of :

C compilers are famous for parsing correct C programs, but not having a
clue what's wrong with a slightly incorrect one. Something to do with
yacc.
In case you havent caught on, "do" is a reserverd word in C.

You might also benefit from downloading a newer C compiler. Borland
gives away 5.5 IIRC, and Microsoft gives away VC8 2005 Express.

Jul 17 '06 #3
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.
Jul 17 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
4
by: Regnab | last post by:
I'm automating the import of all text files into Access from a source folder. I was getting the "Field 'F1' doesn't exist in destination table" error, so I checked it out on the net and it said to...
6
by: Bill Rubin | last post by:
The following code snippet shows that VC++ 7.1 correctly compiles a static member function invocation from an Unrelated class, since this static member function is public. I expected to compile the...
3
by: Caroline | last post by:
I have a CF app and I haven't found a decent obfuscator for it. I want to write a simple obfuscator, that replaces variables and methods names. Is there any way to rename all method names returned...
0
by: HKSHK | last post by:
This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub)...
7
by: flupke | last post by:
Hi, i'm getting errors with the log module concerning RotatingFileHandler. I'm using Python 2.4.3 on Windows XP SP2. This used to work in previous python versions but since i upgraded to 2.4.3...
2
by: Tom Baxter | last post by:
I have a numeric column in a query called Prov1.Volume. When I try taking the sum of that column (using SUM aggregate function in Design View) it gives a syntax error. It says that...
4
by: Steve Barnett | last post by:
I copied and paste a form in my solution and renamed the copy (all done in the solution explorer) and now, when I compile the app, I get the following error: ----------- The item...
7
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I'm new to Visual Studio 2005. I'm creating a windows application using Visual Basic. After I added a control to a form and added some codings to the control, I want to rename the control. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.