Thread: compiling my code, i can't fix error

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    3

    compiling my code, i can't fix error

    Code:
    }
    	double celsiusAtDepth;
    {	
    	double celsiusAtDepth=10*depth+20
    	return celsiusAtDepth;
    }
    after I compiled my code, I have an error saying:
    part1.c:29: error: expected identifier or â(â before â{â token

    Up above, i posted lines 27-32

    this is the only error i have left to fix, and i can't do it. Can someone please tell me why I keep getting the errror and how to fix it?

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    And what part of the function is this?
    Could you show the whole function
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Indenting properly, it becomes:
    Code:
    {
    	double celsiusAtDepth;
    	{
    		double celsiusAtDepth=10*depth+20
    		return celsiusAtDepth;
    	}
    	/* ... */
    }
    And note the missing ; after the line where you define celsiusAtDepth.
    Note that this code isn't very meaningful either. You redefine the same variable later with something else. Either it's global (you mismatched a bracket) or you did something else very wrong.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  3. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  4. using c++ in c code
    By hannibar in forum C Programming
    Replies: 17
    Last Post: 10-28-2005, 09:09 PM
  5. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM