How to Deal With Errors in C Programming

To err is human–everyone makes mistakes. If you are coding in C, even simple mistakes can break your program. A missing ‘;’ is all it takes to make the compiler spit out errors and refuse to compile your program. However, it is relatively easy to fix these errors because your compiler will provide information about the location of the error. Logical errors, on the other hand, can be difficult to fix depending on their complexity.

A single error can result in error messages for subsequent correct statements. This generally happens with statements that refer to something that is supposed to be defined by a statement containing an error. If a statement that defines something has an error, then what was supposed to be defined won’t be.

Example program showing an error:

#include<stdio.h>
int main(void)
{
printf("If at first you don\’t succeed, try, try, try again!")
return 0;
}

If you now try to compile this program, you’ll see an error message shown below:

Syntax error : missing ‘;’ before ‘}’
HELLO.C – 1 error(s), 0 warning(s)

The compiler is able to determine precisely the error and its location. There should be a semicolon at the end of that printf() line. It’s so easy to forget a comma or a bracket, or to just press the wrong key. Even experienced programmers make exactly the same mistakes—even after years of practice. However, with experience you will make fewer mistakes and be able to locate and fix the errors without much difficulty.

Contributed by Prasad G. Prasad works as programming instructor and has years of experience in teaching, programming and writing.

Microsoft WebMatrix: A New Tool to Build Cool Websites

Microsoft has launched a new tool known as "WebMatrix" aimed for easy development of websites. WebMatrix is suitable for both newbies and advanced Windows users. With WebMatrix one doesn’t have to bother about server configuration, database management, and other settings–WebMatrix takes care of everything for you. The tool comes with a web server, a web framework, and an embedded database.

Microsoft WebMatrix

Using WebMatrix, you can utilize the full potential of IIS Developer Express (web server), ASP.net (web framework), and SQL Server (embedded database compact). It comes with all the tools needed to build and launch a website. These include a code editor, a database editor, an FTP management tool and more.

To conclude, WebMatrix is a powerful tool which is simple to use. Irrespective of your programming skills, you’ll enjoy using it.

Download Link for WebMatrix: http://www.microsoft.com/web/webmatrix/

SMIL–Synchronized Multimedia Integration Language

SMIL or Synchronized Multimedia Integration Language is a tag based language specifying the temporary structure of a presentation in a similar way to that in which the structure of a hypermedia document can be specified in HTML. Like HTML, SMIL being a purely text-based language can be written using any text-based editor. It doesn’t require special authoring tools.

SMIL is defined by an XML DTD. At the outermost level, the document structure is similar to that of an HTML document. The entire document is a “smil” element whose contents consist of a “head” followed by a “body”.

The real substance of a SMIL document is its body. The most interesting elements that may appear in the body’s content are the synchronization elements, for which temporary properties can be specified. These include two compound elements, “par” (parallel) and “seq” (sequential). Each may contain media object elements, which specify the actual images, video clips, sounds and so on, that are used in the presentation.

Suppose we wish to assemble four elements for a presentation: two images, a quick time movie and a sound clip. Initially, the first image is displayed together with the movie but after five seconds it is replaced by other image, which is displayed for ten seconds before the first image comes back for another fifteen seconds. While this is going on, the sound should start playing after five seconds and continue until twenty seconds into the presentation. We have three things going on in parallel here: a movie, images and sound, with the images themselves being displayed in sequence. The complete body is as follows:

<body>
<par>
<video src=”ml.mov” type=”video/quicktime” />
<seq>
<img src=”image_1.jpg” type=”image/jpeg” dur=”5S” />
<img src=”image_2.jpg” type=”image/jpeg” dur=”10S” />
<img src=”image_1.jpg” type=”image/jpeg” dur=”15S” />
</seq>
<audio src=”sounds/sound1″ type=”audio/aiff” begin=”5S” end=”20S” />
</par>
</body>

Constants in C Language

Constants in C Language

A constant is a fixed value that the program may not alter. Constants can be any of the basic data types i.e. they can be int, float or char. The way each constant is represented depends on its type. Constants are also known as literals in C i.e. constants and literals are one and the same.

Character constants are enclosed between single quotes. E.g.’a', ‘%’ represent character constants. In C, you can use both multibyte characters and wide characters. Multibyte characters consist of one or more bytes while wide characters are usually 16 bits long. Multibyte characters and wide characters are used to represent languages that have large character sets. To specify a multibyte character, enclose the characters within single quotesm for example, ‘xy’. To specify a wide character constant, precede the character with an L.

For example:

wchar_t wc;
wc=L’A';

Page 1 of 3123»