local block
#1

local block

[attachment=17840]
. What is a local block?
A local block is any portion of a C program that is enclosed by the left brace ({) and the right brace (}). A C function contains left and right braces, and therefore anything between the two braces is contained in a local block. An if statement or a switch statement can also contain braces, so the portion of code between these two braces would be considered a local block.
Additionally, you might want to create your own local block without the aid of a C function or keyword construct. This is perfectly legal. Variables can be declared within local blocks, but they must be declared only at the beginning of a local block. Variables declared in this manner are visible only within the local block. Duplicate variable names declared within a local block take precedence over variables with the same name declared outside the local block. Here is an example of a program that uses local blocks:


. Should variables be stored in local blocks?
The use of local blocks for storing variables is unusual and therefore should be avoided, with only rare exceptions. One of these exceptions would be for debugging purposes, when you might want to declare a local instance of a global variable to test within your function. You also might want to use a local block when you want to make your program more readable in the current context.
Sometimes having the variable declared closer to where it is used makes your program more readable. However, well-written programs usually do not have to resort to declaring variables in this manner, and you should avoid using local blocks.


Can the last case of a switch statement skip including the break?
Even though the last case of a switch statement does not require a break statement at the end, you should add break statements to all cases of the switch statement, including the last case. You should do so primarily because your program has a strong chance of being maintained by someone other than you who might add cases but neglect to notice that the last case has no break statement.
This oversight would cause what would formerly be the last case statement to "fall through" to the new statements added to the bottom of the switch statement. Putting a break after each case statement would prevent this possible mishap and make your program more "bulletproof." Besides, most of today's optimizing compilers will optimize out the last break, so there will be no performance degradation if you add it.


Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: separators for braces, local interconnect block diagram, biocybernetics brace,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  VLSI Design and Implementation of Low Power MAC Unit with Block Enabling Technique project uploader 1 1,662 02-10-2012, 01:09 PM
Last Post: seminar details
  FFT/IFFT Block Floating Point Scaling seminar details 0 758 05-06-2012, 05:15 PM
Last Post: seminar details
  Local Construction of Near-Optimal Power Spanners for Wireless Ad Hoc Networks seminar paper 0 559 14-03-2012, 03:46 PM
Last Post: seminar paper
  Local Area Networks seminar paper 1 851 13-03-2012, 11:28 AM
Last Post: seminar paper
  Block Ciphers - Analysis, Design and Applications seminar paper 0 268 09-02-2012, 02:31 PM
Last Post: seminar paper
  IEEE Standard for Local and Metropolitan Area Networks seminar addict 0 890 25-01-2012, 03:58 PM
Last Post: seminar addict
  STOCHASTIC LOCAL SEARCH seminar addict 0 679 18-01-2012, 12:42 PM
Last Post: seminar addict
  ELECTRICAL MACHINES name and block diagram seminar addict 0 1,166 10-01-2012, 10:09 AM
Last Post: seminar addict

Forum Jump: