Hello everyone.
Welcome back.
This is our final lecture.
This is our course summary.
So we're at the end.
We're wrapping up.
I wanted to remind you of everything that you learned in class.
Everything that we've gone through you can just -- if it took you a
while to complete the class, this will just remind you of some of the
important concepts that we covered.
So we learned all about code blocks.
Code blocks is our integrated development environment.
It allows us to edit our c programs.
It allows us to execute our c programs.
It also allows to debug our c programs.
Debugging is important, it helps find and fix our errors.
So we have a nice little tool that we can use to write
our programs, very useful.
Code blocks, I like it's graphical use interface.
It's very user friendly and very easy to use.
We also discussed some of the basic operators in c.
These are our logical operators, our arithmetic operators, our assignment
operators, our relational operators.
Logical operators are like the ampersands and the ors.
You can compare information arithmetic operators plus
minus multiplication so forth.
And then the all-important assignment operator which
assigns data to variables.
We talked about conditional statements.
This is where you make decisions in your programs.
This is where you -- it's no longer sequential.
You may be jumping out of blocks.
You may be executing different code based on the answer to
a question, whether or not evaluates true or false.
So we also learned about Boolean evaluations or Boolean expressions.
We learned about specifically the if statement.
How to use nested if statements nested or else statements.
We talked about the switch statement, which is very useful
to use when you're comparing constants or a variable.
It can eliminate many of many of the if else statements
if you use the switch.
Switch is also more efficient.
We talked about how when you use switch, you have to use break
to jump out of certain cases, a lot of good information with
making decisions in your program.
We talked about repeating code, which is related to control
flow just like if statements.
You may execute a line of code many times.
You're no longer doing sequence coding.
So these are looping constructs.
These are different keywords that you can use in language
such as for, while, do while.
The for and the while are very similar.
You can pretty much do everything you do before you can do in a while.
What they're referred to as is pre-test loops.
You may execute the body of the loop once or you may execute the
body loop many times or zero times.
The do while loop is specifically different
because it's a post-test loop.
The condition for checking is at the bottom of the loop.
So you're always going to execute that loop at least one time.
It's very, very useful to be able to repeat your code in a program.
We also talked about arrays.
Another very important concept.
Arrays allow you to have group data together based on a data type.
So instead of creating 10 variables of type int, you can create one name
of int and it can store 10 elements.
So an array has special syntax with the square brackets.
You identify the size.
There's a way to set initial data to an array.
We also talked about multi-dimensional arrays, which is essentially
a matrix or spreadsheet.
It's an array that contains rows and columns.
We moved on to talk about functions.
C is a module language.
C is organized around functions.
Functions is a way to reduce duplicate code.
You can invoke the name of something, and then the name can contain a group
of code that you want to execute.
We learned all about the syntax for functions how you can return
data from functions, how you can pass data to function.
So we learned a call by value versus call by reference,
arguments and parameters, declaring function prototypes at the top
of your file which is useful.
We talked about debugging.
Debugging invaluable, it's really problem solving techniques.
It makes you become a better problem solver.
And when you write code problem solving is an essential skill.
So when we talked about debugging finding fixing your errors, we talked
about specific concepts related to it, such as the call stack, where
you can identify if your program crashes where it crashed by what
different functions are invoked.
We talked about common mistakes in your c code, whether it's not
initializing variables or missing semicolons or missing brackets.
And then we follow that up with understanding compiler message.
You may understand some common mistakes.
But if you don't understand the compiler and what the
compiler is telling you, it's really hard to debug.
So we talked about the specific errors that the compiler tells you
and how to interpret those errors.
We moved on to structs.
Structs are a big important concept.
They're similar to arrays, but structs are even more powerful
because structs allow you to group specific elements with different
data types to a specific name.
So we used examples like time and day structs which allowed you to store
like hours, minutes and seconds, also dates like years and so forth.
But structs are great use the struck keyword.
You can group together different variables or different types
and refer to it in your program.
It's almost like defining another data type.
There's specific syntax on how to initialize drugs.
We also talked about nest structures.
Structures that contain structures.
We talked about using pointers and structures.
And character strings we discussed.
Character strings are basically arrays of characters.
There's different operations you can provide on these
different character strings.
A lot of different string manipulations functions
through the string.h.
We talked about the basics of these different character strings.
And then the most important concept in the course pointers.
And the most difficult concept in the course.
But a very useful concept.
It's important to understand pointers.
Pointers are essentially a variable that contains an address.
Pointers allow you to allocate memory dynamically at runtime.
Pointers are essentially allowing you to manage and
manipulate your own memory.
There's no garbage collector in c, like there are in
a lot of other languages.
We learned how to define and use our own pointers
using the asterisk syntax.
We also learned how you can pass pointers to functions,
which now allows you to do essentially pass by reference.
We talked about pointers and arrays.
We talked about how character pointers are essentially
character strings, character arrays and their similarities.
We talked about mallocing data which is allocating memory freeing data,
and we also talked about pointer arithmetic, which is really, really
great notationally because it allows you to go through a character
different spots and memory very fast and in nice notational convenience.
You can reduce the amount of code that you write.
But pointers, again, most important concept in the course really,
really have to study these because it is very confusing concept.
Pointers tend to get abused quite a bit in c.
Either not allocating memory appropriately or freeing memory
or pointing to the wrong memory address or going out of bounds
of arrays or out of bounds of your memory locations.
Most important c programs actually all important c programs
are going to contain pointers.
We learned about the preprocessor, not a ton, but information about defining
constants and using the include directive to include other header
files so that you can reuse code provided by the c standard library.
And also creating your own include files if you want to reuse functions that you wrote.
Input and output.
This specifically had to do with reading command line arguments in
your program or utilizing a scanf to read from the keyboard or printf
to display output to the console.
Printf is great to use for debugging.
Scanf is great to read input from the user.
Most programs will ask the user for data.
So scanf is the way to do it.
And then command line arguments passing in data to the
program from the command line.
This is closely related to file input and output.
We learned how to read and write the files.
Files allow you to store persistent data.
Most important programs and see you need to store a lot of data
and you need to have it there when you reboot the computer.
This is what writing the files and reading from files to.
And we learned a lot of a lot about important functions provided by the
standard lib header, fgetc, fgets to write strings, write characters and
then file formatting functions like fprintf and fscanf, very, very nice.
We learned about the standard c library, mainly the string
manipulation string functions.
But we also discussed the math functions used for arithmetic,
utility functions for getting environment variables or for exiting
a program and then the standard header files that are used in
most programs like limits.h and some of these other nice ones.
And so the outcomes of the course, what you should
now understand regarding c.
You should be able to write beginner c programs.
If you can't write a beginner c program at the end of this class
and you've studied everything, then I have failed as an instructor.
I hope that writing basic programs is second nature to you by now.
But with programming, it all takes practice.
You have to practice, and you have to write a lot of code, and you're going
to get better and better as you go.
You're able to now write more efficient in high quality c.
Throughout the course I tried to focus on high quality code.
And what this means is allowing your code to be easier to maintain,
easier to find and fix bugs.
When you release a program to a customer, that program may
be out there for 5, 10 years.
You may add new features.
You have to fix bugs.
And so, you want to make sure your code is of high quality.
What this means is your code should be module.
It should be organized around functions.
Your functions should be cohesive.
They should have a single focus.
They shouldn't be doing 10 different things.
You shouldn't have functions with a thousand lines of code in them.
If you have a function for reading input, have it read the input,
don't have a print output and do all sorts of other things.
Modular programming is very, very important.
And luckily c is organized around the functions and supports this.
You want to make sure your programs have low coupling.
What this means is they don't have a lot of dependencies.
You're not depending on using global variables or you don't have a function
that's using a global variable.
Coupling, the more dependencies that you have and if you have
tight coupling, it's harder to debug your program because now
an error can occur anywhere.
If you limit your coupling, it's easy to isolate those errors.
Coupling again can become in the form of functions that are working
together too much with global data.
It also means that you may have more dependencies in your other
header files and so forth.
And then addition to writing high quality c code with implementation,
you also want to make sure you make your code readable.
And what this means is you could have good naming conventions.
If you create a variable don't create the variable with the name
x1 or p1, use a meaningful name.
What the variable's actually storing?
If it's storing data related to employee ID, create the
variable name with employee ID.
If you're creating a function that adds two numbers, name the
function add, common sense type stuff which makes your program much
more readable, which, again, makes the code easier to understand.
In addition to using meaningful naming conventions, you also want to provide
indentation for any blocks of code.
It makes the program easier to follow.
If you had all of your code with no new lines and no indentation
in just a bunch of lines, it would be really hard to follow.
So use indentation and use spacing in new lines.
You're also able to debug and be a better problem solver
at the end of this course.
You understand how to use the debugger and code blocks.
You understand compiler messages, a vital essential
skill for every programmer is problem solving and debugging,
finding and fixing your errors.
Also you can use printf statements to find errors as well.
You now should understand the fundamental aspects
of the c program language.
Everything we talked about in this lecture and all the
lectures throughout the course.
And so what I want to say to you is congratulations.
Be proud of yourself.
The c programming language is not an easy programming language to
learn, mainly because of pointers and your memory management flexibility.
So you need to pat yourself on the back.
You did a great job.
You got through the course and you learned a lot about a
difficult programming language.
This is going to help you become a better programmer in the long term.
It's going to allow you to easily learn other languages because a lot
of the languages are based off of c.
So be proud of yourself.
I hope this helped you with your confidence in terms of
the ability to write the code.
You don't have to be a rocket science to be a programmer, and I
hope that this class and that you finishing helped you with this.
Now always I also want to mention that don't hesitate to ask
questions, whether it's feedback via the ratings or whether it's
constructive criticism, I'm here to answer your questions.
So just because you've gone through the entire course and listened
to all the lectures, it doesn't mean that you can't ask me for
help on if you're writing other programs or you're having other
difficulties with other concepts.
Send me feedback, ask questions and I'm always
looking to improve the course.
And for that matter, if you think that maybe one of the concepts
wasn't adequately explained, you let me know, I can write some more
lectures or try to improve on it.
I'm always looking to improve the course.
I'll make course updates throughout the class to improve it,
so feedback is important.
And last but not least, I want to thank you for
signing up for the course.
It means a lot to me, I put a lot of effort in this.
And so I appreciate that you signed up for the course.
And again, my hope is that you learned a lot.
But pat yourself on the back, and thank you very much.
Good luck.