473,385 Members | 1,397 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,385 software developers and data experts.

In which line it displays error?

129 100+
1. #define CIRCUM(R) (3.14*R*R);
2. main()
3. {
4. float r=1.0,c;
5. c= CIRCUM(r);
6. printf("n%f",c);
7. if(CIRCUM(r))==6.28)
8. printf("nGobbledygook");
9. }
May 21 '08 #1
7 1296
arnaudk
424 256MB
Read the posting guidlines before posting on this forum: Posting Homework or Coursework Questions and Answers.
May 21 '08 #2
r035198x
13,262 8TB
In which line it displays error?


Where do you think it displays the error?
May 22 '08 #3
Laharl
849 Expert 512MB
If you're not sure where the error's going to be, try to compile it and the compiler will tell you where the error is. Or where it thinks the error is, which isn't always quite the same thing, especially when curly brace errors are involved.
May 22 '08 #4
JosAH
11,448 Expert 8TB
btw, that macro sucks and not because pi doesn't equal 3.14.

kind regards,

Jos
May 22 '08 #5
Sick0Fant
121 100+
btw, that macro sucks and not because pi doesn't equal 3.14.

kind regards,

Jos
Is it because it computes the area instead of circumference, or is it the mere fact that he's using a macro for something like this? :-)
May 22 '08 #6
JosAH
11,448 Expert 8TB
Is it because it computes the area instead of circumference, or is it the mere fact that he's using a macro for something like this? :-)
Nope, have a look at that macro definition again:

Expand|Select|Wrap|Line Numbers
  1. #define CIRCUM(R) (3.14*R*R); 
  2.  
that semicolon at the end is a big nono, i.e. that macro can not be used as an
expression, e.g. CIRCUM(r)+1 but that's not the most important blooper: try to
evaluate it for the radius 'a+b', i.e. CIRCUM(a+b). That's why that macro sucks.

kind regards,

Jos
May 23 '08 #7
dtimes6
73
You should never compare the float or double directly.
May 23 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bill | last post by:
I am downloading data from a website that displays it in a table $fp = fopen("a website page", 'r'); The following accesses the stream one <td> element at a time $myData = fgets($fp); Then I...
4
by: susanlimsg lim | last post by:
I have tried to resolved this problem but I dunno how to resolved it can anyone help me?? It cannot be successfully displayed at the mozilla environment // written by Tan Ling Wee on 2 Dec...
3
by: Brett | last post by:
I use the following to output to the console during debugging: catch(Exception ex) { Debug.WriteLine("Error: " + ex.Message); } Many of the times on the console, the above is appended on the...
3
by: Jan E Andersen | last post by:
Is there an option for this It woul certainly make debugging much easier JE
3
by: Lloyd Sheen | last post by:
Is there a setting in VS2003 to ensure that when debugging a page it will stop on all errors. At present it just displays a page with the error but I want it to stop at that line when the error...
0
by: Christina N | last post by:
When my asp.net application halts with an error, IIS displays the error message normally, but the reference to a line number within the source code file is totally wrong. This happens all the time....
6
by: Buddy Ackerman | last post by:
When trapping unhandled errors in a web page via the Page_Error or Application_Error event procedures is it possible to get the line number on which the error occured? When not using custom error...
7
by: John den Haan | last post by:
Hello! When I use putchar to fill up an entire screen (of 80x25) with text, it seems to leave an empty line at the end, thus forcing me to scroll upwards in to see the first line. This forces me...
9
by: sovht | last post by:
System: Intel, Windows XP Pro, SP2 IDE: VC++ 6.0 Problem: *Very* simple program to create a MessageBox only ever displays the first character of the given string. I checked the spec for the...
17
by: Matt | last post by:
Hello. I'm having a very strange problem that I would like ot check with you guys. Basically whenever I insert the following line into my programme to output the arguments being passed to the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?

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.