Home Forums C Programming Best coding techniques

Viewing 0 reply threads
  • Author
    Posts
    • #1929
      niklaesh
      Participant

      hello,
      what do u think is the best coding technique we should adopt?
      I have two exampes here. please comment on them.

      void myFunction{
      int myInt=0;
      if(myInt==0){
      printf("Zero");
      }
      }

      void myFunction
      {
      int myInt;
      myInt=0;
      if(myInt==0)
      {
      printf("Zero");
      }
      }

      Few things to consider here.
      1: initializing the variable and declaring at the same time.
      2: adding the curly braces after the expression
      3: indenting the code
      4: adding the curly braces at the new line.

      Please comment.
      Thanks

Viewing 0 reply threads
  • The forum ‘C Programming’ is closed to new topics and replies.