Follow us on Twitter!Visit  us on YouTube!Join us on Facebook!
managed hosting1 (866) 289-5091
domain hosting Canadian owned and operated
Welcome to the myhosting.com Forums.
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Stoddard is offline Master Member
    Join Date
    May 2010
    Posts
    559

    Default brackets in C programming

    How many different brackets are there in C programming, other than round and curly? And what is the main difference between round and curly brackets, anyhow?

  2. #2
    suwunk is offline Super Moderator
    Join Date
    Aug 2010
    Posts
    861

    Default

    ( ) round brackets (parentheses) = for function declarations/definitions/calls
    { } curly brackets (braces) = to group sections of code
    < > angle brackets for header files = for header files
    [ ] square brackets = for arrays

  3. #3
    evantanski is offline Junior Member
    Join Date
    Jan 2012
    Posts
    3

    Default

    [] for arrays
    {} to group sections of code (like after an if statement)

  4. #4
    evantanski is offline Junior Member
    Join Date
    Jan 2012
    Posts
    3

    Default

    You can apply code with brackets in c.

    #include <stdio.h>

    int main ( void )
    {
    struct
    {
    char c[15];
    int x;
    } table [ ] =
    {
    { "Hello.", 1 },
    { "Do you", 22 },
    { "understand", 333 },
    { "all this", 4444 },
    { "yet?", 55555 },
    };
    int x;

    for(x = 0; x <5; x++ )
    {
    printf( "%s\t%d\n", table[x].c, table[x].x );
    }

    printf( "< > and << >> are omitted because I'm tired of typing all this bold crap.\n" );

    return 0;

  5. #5
    Brynnae is offline Banned SpaceHamster
    Join Date
    Apr 2012
    Location
    Los Angeles
    Posts
    21

    Default

    BODMAS is the rule used in C for opening a brackets.

    First Brackets will be Open then Of will be executed then Division will be performed then after Multiplication, Addition and Subtraction will be executed.


 

Similar Threads

  1. console programming
    By silkysmooth in forum Programming
    Replies: 0
    Last Post: 2011-11-18, 07:27 AM
  2. programming language vs. technique
    By Randy5 in forum Programming
    Replies: 0
    Last Post: 2011-11-13, 07:43 AM
  3. GUI programming
    By Randy5 in forum Programming
    Replies: 0
    Last Post: 2011-10-26, 05:22 AM
  4. concurrent computer programming
    By PotsNPans in forum Programming
    Replies: 0
    Last Post: 2011-10-11, 09:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts