By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,784 Members | 1,239 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,784 IT Pros & Developers. It's quick & easy.

compiler reports unfamiliar errors in function

P: 20
Hi all - The following is the code for one of my functions in a program but the compiler is reporting errors. I've also tried declaring the variable temp within the function but the number of errors reported by the compiler increases. Here's the code just for the function with problems:

Expand|Select|Wrap|Line Numbers
  1. char options();
  2. {        cout<<"\n\nOption 1: Fahrenheit to Celsius - Press C or 1.\n";
  3.          cout<<"Option 2: Celsius to Fahrenheit - Press F or 2.\n\n";
  4.          cin>>temp;
  5.          return temp;
  6. }
The errors that I get are:

parse error before '{'
syntax error before '<'
syntax error before '>'


Can anybody see what the problem is?
Mar 25 '07 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 1,510
you have a ; on the header of the function definition
Expand|Select|Wrap|Line Numbers
  1. char options();
  2. {
  3.  
try removing it - you only have the ; if it is a function prototype
Mar 25 '07 #2

P: 20
Thank you so much... it works now that I took out the ; and declared the variable within the function.
Mar 25 '07 #3

Post your reply

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