LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-02-2007, 01:20 PM   #1
dragonmint
LQ Newbie
 
Registered: Jun 2007
Posts: 1

Rep: Reputation: 0
Question GCC compiler giving syntax error before 'double' error


...............................

Last edited by dragonmint; 06-07-2007 at 03:57 PM.
 
Old 06-02-2007, 02:05 PM   #2
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
You appear to be invoking double as a function when in fact it is a type definition. Without the parens, the compiler is interpreting double as a type definition, and this is a syntax error on the right side of an equal sign.

When you put the double in parenthesis, you are using it as a type cast, causing the result of the operation to its right to be cast as a double.

I'm not sure what you are trying to do really, but it looks to me like you should define some new variables as type double, then perform your rand() functions to these double variables, then perform your division operations using the doubles. The output will then naturally be a double unless you cast it to something else.
 
Old 06-02-2007, 02:07 PM   #3
elsheikhmh
Member
 
Registered: Aug 2004
Location: Cairo, Egypt
Distribution: Slackware
Posts: 101

Rep: Reputation: 15
use [code] tags. it's easier to read

[edit1]

Last edited by elsheikhmh; 06-02-2007 at 02:09 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gcc gives error C compiler cannot create executables ADD Linux - Newbie 6 01-03-2006 05:43 AM
in gcc compiler error: parse error before string constsnt cynthia_thomas Linux - Networking 1 10-20-2005 01:29 AM
line of programming that keeps giving a syntax error at end of input mshinska Programming 1 10-03-2005 08:49 PM
gcc compiler error maheshbmane Programming 3 09-02-2005 09:23 PM
Gcc compiler error Yoda Sabre Linux - Software 9 08-16-2004 03:53 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration