The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Basic OS question catwomen HP-UX 4 09-08-2006 05:39 PM
a very basic question regarding gcc... caltiger High Level Programming 2 09-04-2006 04:16 AM
Really basic question.... robherms UNIX for Dummies Questions & Answers 1 02-17-2006 06:50 AM
basic question urwannabefriend UNIX for Dummies Questions & Answers 1 04-10-2004 02:21 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-13-2006
Registered User
 

Join Date: Aug 2006
Location: La Jolla
Posts: 4
q_zero question basic C

What am I doing wrong?...

My code looks like this:

[File: q_zero/q_zero.c]
#include <stdio.h>

float answer; /* The result of our calculation */

int main()
{
answer = 1.0 / 3.0;
printf(“The value of 1/3 is %f\n”, answer);
return (0);
}

==============================END

And this is what I get in terminal when I try to compile it:

[localhost:~/learning_c] aaron% gcc q_zero.c o-q_zero
powerpc-apple-darwin8-gcc-4.0.1: o-q_zero: No such file or directory
q_zero.c: In function 'main':
q_zero.c:8: error: stray '\210' in program
q_zero.c:8: error: 'The' undeclared (first use in this function)
q_zero.c:8: error: (Each undeclared identifier is reported only once
q_zero.c:8: error: for each function it appears in.)
q_zero.c:8: error: parse error before 'value'
q_zero.c:8: error: stray '\' in program
q_zero.c:8: error: stray '\211' in program
[localhost:~/learning_c] aaron%
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-13-2006
Hitori's Avatar
Registered User
 

Join Date: Jun 2006
Posts: 356
1) you are using wrong qoutes in printf(“The value of 1/3 is %f\n”, answer);, use 0x22 "
2) wrong option format (gcc q_zero.c o-q_zero), must be gcc q_zero.c -o q_zero
Reply With Quote
  #3 (permalink)  
Old 08-13-2006
Registered User
 

Join Date: Aug 2006
Location: La Jolla
Posts: 4
I see the problem with the location of "-o" but I'm not sure I understand what you mean by the wrong type of quotes. Could you rewrite the code so that I can see it in use?
Reply With Quote
  #4 (permalink)  
Old 08-13-2006
Supporter
 

Join Date: Jul 2006
Posts: 156
The code looks the same. It's the quote characters you are using. You aren't using ascii characters, they are unicode characters. Change them to ascii characters. The ascii representation for quote character (") is stored as 22 hexadecimal, or 34 decimal.
Reply With Quote
  #5 (permalink)  
Old 08-13-2006
Registered User
 

Join Date: Aug 2006
Posts: 69
I hope that [File: q_zero/q_zero.c] is not a part of your source code.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:55 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0