Welcome to the myhosting.com Forums.
-
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?
-
( ) 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
-
[] for arrays
{} to group sections of code (like after an if statement)
-
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;
-
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
-
By silkysmooth in forum Programming
Replies: 0
Last Post: 2011-11-18, 07:27 AM
-
By Randy5 in forum Programming
Replies: 0
Last Post: 2011-11-13, 07:43 AM
-
By Randy5 in forum Programming
Replies: 0
Last Post: 2011-10-26, 05:22 AM
-
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
Forum Rules
Version 4.1.7
Copyright ©2000 - 2013
All times are GMT -4. The time now is 05:55 PM.