compiling my code, i can't fix error

This is a discussion on compiling my code, i can't fix error within the C Programming forums, part of the General Programming Boards category; Code: } double celsiusAtDepth; { double celsiusAtDepth=10*depth+20 return celsiusAtDepth; } after I compiled my code, I have an error saying: ...

  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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    And what part of the function is this?
    Could you show the whole function
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,537
    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, 03:35 PM
  2. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 06:33 AM
  3. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 09: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, 04:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21