Thread: Indent code

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    59

    Indent code

    Hi Guys,

    Could someone show me a good example of how to
    indent code..


    Thanks alot

    Boontune

  2. #2
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    Code:
    {
    	{
    		{
    			{
    			}
    		}
    	}
    }
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  3. #3
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    umm... tabbing within each level within loops is a good start.
    EntropySink. You know you have to click it.

  4. #4
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    First of all, if you are part of a professional team of programmers or are taking a programming class, go by whatever standard your boss/teacher sets. If you just need to indent for your own sake, and no one else will see your code, do whatever you have to do. There is disagreement in the programming community over some indenting. For example,
    Code:
    // some people do this
    function(int x)
    {
    	// code goes here
    }
    // others do this
    function(int x){
    	// code goes here
    }
    No one can really tell you which way is better. I've seen some good arguments to support both sides. If you have the freedom, do what feels right to you.

    But, in general, indent everything in a loop, a function(including main), and a conditional statement(like if or switch).
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  2. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM