Now, we're going to turn our attention to some of the nitty-gritty details of how to write a correct C program. We're going to look at a very simple program. I'm going to show it in its execution Window. But first, I wanted to discuss what we're going to look at. So this program is going to print the sum of two floating point numbers and it's going to use simple IO. It's going to use the scanf to read in the values and then printf to show the results. Now, the elements of a C program are made up of characters, so it's just like an essay in English. Except an essay in English could be understood even if you have misspellings and punctuation errors. In case of a C program, spellings, punctuation errors, mistakes of that kind, get caught by the compiler and the compiler won't let you run the program even though you think you understood and it should have understood this simple mistakes. Now hopefully, a good C compiler will give you informed messages that make it clear what it thinks is wrong. So first off a program in C assembles a bunch of characters into what we call tokens. Let's look at a little of what a token is. So these tokens or lexical elements might be comments for example. A comment is something that starts with slash, asterisk and then can be any set of characters. So those set of characters get ignored until you see an asterisk, slash. What if you forget the second part or write this incorrectly? Then this is going to go on forever and you'll get some error message. Hopefully, it'll say you didn't complete your comment. A second thing that we've seen already in C programs are preprocessor directives. Begey is sharp include. So preprocessor directive starts by putting a sharp. Typically by convention, a sharp should be at the beginning of the line, and then we have a number of possible special words, and include is one that says to the compiler, the following library should be included. We of course have already made use of standard IO. But there are other important libraries like the math library, like the character press in library, like the library that includes timing operations, time.h and there are multiple very important standard libraries that you're going to often get familiar with. Another big part of having a program be correct are things like identifiers. These are possibly multi-letter, but they can be as much as single letter tokens. So a and b can be identifier and we'll see that in the next program, and main is a typical identifier because it indicates is special in the sense that in a case where the program is going to start executing. We also have tokens that are operators. So plus is a token for binary operator or in context, it could be a unary plus. Ampersand is an operator, meaning address of, but again, you got to have contexts. So sometimes you can see two ands and two ands are the operator for logical way. Then this punctuation, also highly important. So we've already seen punctuators like the open brace and the closed brace, and the semicolon, and each has an important use in the language, and you must get them to correct or else you'll make fundamental syntax errors. So program must end up being syntactically correct. So we write a program, we get our ideas down, and now, we have the compiler check that it's syntax correct. So here's a possible syntax or message, we'll have int, main, paren, paren, and then rather than a curly bracket, we might mistype and have an open parenthesis. Now, it would be wrong. So the compiler will issue some message. Hopefully, you'll be informed. It almost always points you at where it sees the beginning of the error, and then hopefully, it gives you an English language message that is helpful. But you have to make sure you understand where the error occurs and how to correct. Then harder than that, is to get the program to work right, semantically correct, it works. Here, is where we possibly repeatedly run, modify and retest the program until we get it right. Okay. In the next segment, we'll go on to the actual code for the program in which we've seen these tokens parsed by the compiler, the compiler compiling, and executing.