## Transcripts

1. Introduction: Hello everyone. My name is Bashar and I will be teaching you everything you need to know about C programming language and are promised by the end of our course. You will be having a very good base foundation to write your own simple codes. Using programming language, you are able to communicate with our computer. That is by using a predefined commands and then a very specific way. So before anything, I just want to tell you that don't let your age stop you from learning new stuff. No one must say that I am too old to start learning something. So there's no age limit to learn programming. And thus, it will always be a good time to start. What it needs. A just needs some carrots and commitment. So let me introduce you to our language that we will be using, which is C programming. C programming is an awesome language. I recommend that since knowing and understanding C language will make it much easier for you to learn other languages too. Since many other programming languages are written in C, such as Python, Java, C plus plus, C sharp, burn Ruby. Not to forget that also many operating system programs, such as windows, unix, Linux are written into the language too. So you will be learning the other languages in no time if you have a good bayesian c. So I hope you enjoy my course. Mate, meet your expectations.
2. How to install Codeblocks: So now, you know a little bit about the history, as I explained in the introduction, why don't we go dive in to our main goal. So to start, we need something called the compiler, which is a special program that is able to compile the instruction that rewrite. Or in other words, it translates the instructions that we write into a language the computer understand. So for that, I will show you how easy it is to set up our C compiler that we will be using in this course, which is called the blocks. So let's go to our browser. I will be using Google Chrome. I will tie into the search bar, got lots, which is the name of our combiners. Down. Load. After that, we will go, you can go through the first side that shows up and then download binary or to the second website download binary code blocks. So we'll press that. And then we'll go down to this. You will search for God bloods, 20.03. Ming damn you. Set up dot extends. So you, you'll download this. So we go the download frown and Aldon notice some sorts forge dot naught k. So after you pass that link, this method will show up that you are downloadable started shortly. And it must start in any minute now. And here it is. It's downloading. So I have downloaded that before. So I'll just go to my download files. Gandhi editors. So we'll run it. So we'll go through these. Next. I'll agree to the license and give these as default. Did not change anything. Okay, and then next and start installing. Ok. So after it is done installing, this will pop up, which asked us, do you want to run call the blocks now, let's do that. Yes. And here it is, our compound. Okay, so now I will be teaching you how to get your first sci fi. So once you open your column blocks, for sure you realized this. Those many things GoldieBlox has in dissenter. I have to create a new project, open an existing project, and Xander. So what do we will do is that we want to create a new project every time we want to write a new got. So clear. So creating a new project. So this, but let me say something. We, you can create project either from here, create a new project, or you can go up here, File New, and going down to the project. Okay, what would lead you to the same way? We continue. Ok, so we will be working on concert application, which is a basic C project you can't run on your computer. Okay, now keep going. So constant implication gown and then the next, ok. So here you need to make a selection is a C or C plus plus, but we want to be using C will be teaching in C. So C, So the C plus, plus and next, okay? Okay, so now here we need to give you need to be given name to the project. I'll type but as the shot. Okay, for example, and are located on my desktop as it does. So i'll keep up. After that. Just keep everything as default. Next year also as default did not change anything and finish. And by this, we are done. So you just notice your project name popped up here. Okay, popped up here and down that there is something called sources. As you can see, the opening dat, if you press this file, which is called main.cc, created by code Bloods. If we double-click on it, this symptom, God will show up, which is if you went out and say that it's a different program. So you see some statements that we will be discussing later each date and what does it mean? But for now, I wrote The showing them how to run this program and let us see together what does it do? What does the statements tell the computer to do? So going up here, you will see a small and green play button, which we were oppressed every time we wanna run our program. So pressing Enter, this will show up that says that our project has not been built yet. So do you want to build it now? Yes. Bonded. And here it is. So this program prints on the screen hello world to ISD's can relate to note this here. There is hello word. So on the screen, this program prints hello world. So basically it's a grieving gusts. So keep in mind that our very first God that you were right is to get it back. This is what we call the command prompt. Basically, whenever we done any program, it will show up in order to execute it. So this is the command prompt. And by here, you're ready. You, you have your C combiner, you knew how to run your first stifle dissent appears. First, define the run the default program. So continue watching to know how to write your own program.
3. Syntax : So now we had set up our C compiler, our first seed project. So the first Sci-Fi and grant a default program. You must be very proud. You just took your first stab into C language. So now I will talk about the syntax. And I mean my dad, that I will be mentioning the set of rules that every C program should have. Every program consists of Hadar, a main function, and the program code, or the body, or the body. So I'll start with that. Every program must start with including the libraries that will be used later on in the program in the header files. So how to mention the libraries, or what do we mean by libraries? Libraries genuinely include the function that are built in, in the C language, the one who mentioned our library. Now we have access to all the functions that are in this library. So the most use libraries are stdio.h, stdio.h, and map the dates to include a library in a C program. We write Md headed at the top of the program. Hashtag include, and we open that less than, bigger than symbols. Okay, and between these two symbols, we write the name of the library that we want. So, so here are some examples on how to mention the libraries. So as I mentioned before, the sum, the sum of the library's named, Are they ISAF we want but has a, so if I want to include stdio.h, we're right. Hashtag include stdio.h. Stdio.h. H stands for standard input and the output had their files. If we wanted to include demand that.h library where right-hand side include Math.abs. Moving on, SBDC statement. Moving on, CDC statement must end the month with the stamp call. So as you see here in the variable declaration, that this statement must end with the back, end with a semicolon. And this function, the print are fielding a desolate must end with a semicolon that determines end with semicolon. Okay? So every statement within the body must be written in the body, must end with a semicolon. So, but not that when we mentioned the library's ICC here, we did not put the semicolon, but don't worry, in case you forgot. We have your back. The C compiler when the type the error and tell you. So let me show you. So let's go to our God, the Bloods semicolon. Next, next. So here it is in the sources main, just so we have here the default program that we're ready. So, so I'll just say Hello World. And do not forget the semicolon. Okay, and let's pretend that I forgot the semicolon. And they went on and plants and press the run button. Okay, build as we saw. Oh, here it is. The compiler will directly so me and error message. As you can see, not only that, it shows me on which line my editor is. So here tells us error expected that to be a semi-colon buffer before that it turn on line six, zygote the lines x also here it shows you that it's online. Thanks. So here it is. I forgot my semicolon. So let's go and run our program yes, buildup. And here it is. This time the program, rod and our screen or printed an artist's dream. Do not forget that semicolon. So I'll just do another small nothing's broken off. I want to thank compiler. Thank you Michael. So here it is. Same term I compiled. Our compiler executes every statement in order of appearance. So the execution of the instruction starts when the execution of the previous one.
4. Variables: Since one we write a program, it is not as simple as the different programs that we saw earlier in the code blocks. So it will be hard to keep track of all the data that we might be using in the program so that this Y variables were created. So we ask ourselves, what are variables? How do we use them? Where do they come in handy? As Adi a bit is a memory area that holds one and only one information at the time, or one and only one value at a time. So if you want to think of a variable, think they are boxes that fits only one item at a time and record them variables because their value can't change during the execution of the program. So maybe I will be putting a green shoe in the box. But later on and wanted to upload shoe. That is so easy to do, just infused tabs if we are using variables. And we will see how soon. To start with variables. First, each variable must have identifier. What do I mean by that? An identifier helps us detect the valuable, and that is why the valuables identifier is the variable's name. The identifier or the variable's name, must be an alpha numeric characters were the first one must be alphabetic. So we went to our naming a valuable the first flatter over the vacuum and must be alphabet debt, and all the other characters must be alphanumeric. So what do I mean by alphanumeric and what are the alphabetic characters? Nsc Program. So the alphabetic characters that are accepted to be as a first letter, as a variable's name. The alphabetic, the English alphabet, letters that we know from a desert as a gap button, the lower case alphabet, the dollar sign, and the underscores toys. So these are the anthropometric characters. However, the numeric characters are from 0 to nine. Okay? So I'll be giving some examples and let's see together if they are accepted as variables names. So the first one is Bashar too, and so we chuck or the characters, but alphanumeric. And it starts with a, with an alphabet, with an alphabetic one. So it is a variable's name. The second one, ok. All of them also are alpha alphabetic. And that starts with an underscore, which we saw is an alphabetic. So it's all considered as our variables name. The third one is also considered as a bad day with names that start with an alphabetic character, the lowercase h. It has numbers which are pneumatic and not at first, so they are accepted. And the dollar sign is also as a, is considered as an alphabetic character. The third one is also since it's alphanumeric characters starting with an alphabet. So here the third, the fourth one, the fifth one, sorry. It's not y. Let's see together why it's not an alphabet and a variable's name, since it starting with the alphabet directed the uppercase D. But let's see, there is an apostrophe which is not considered an alphabetic character. Moreover, you have the space here. So we have two adders made, two mistakes made, made here. So we have the apostrophe and we have the space. The fourth ADA announced one. Ok, it is alphanumeric, but it is starting with a number. And we set the first character in a variable's name must be an alphabetic, so it's also wrong. So you may be asking yourself, why did I write two variables named same, Bashar, Guan De, and Bashar 20. Now, I did not write them twice. Each of these two variables named They are different. Since C language is a sensitive as a case-sensitive language, which means that using an uppercase B difference from using a lowercase b. So even if all the characters are identical, but the difference is that one character is a lowercase and the other is an uppercase. These two, these two variables are considered different. So we will take another example. So the skin is different from skill if I wrote the two double ALS as an uppercase. So keep that in mind. When you're writing a variable, makes sure always that you are writing it properly. Be aware of the case sensitivity.
5. Datatypes: So now after learning how to write a variable's name, we have to call datatypes. And these declassify what kind of information we are going to store it in the variable. So what are the different types of information that we can store it in a C language program. The very first data type which you will be using a lot is the data type that I've used for storing numbers. So we will start with the datatype in order to store an integer, which we all know that an integer is a whole number. So we use a data type called int, where you can realize that it is the abbreviation of integer. So to remember, when we want to declare a variable, we need to identify the datatype and the variable's name. Hence. In our case, if I want to declare an integer variable, we would say that data type, which is integer, followed by the variables name. So for example, let's say integer counter and do not forget, of course, the stamp column, as we said, that every statement as the statement must end with a semicolon. So let's take other examples. For declaring integer variables. We can say integer number. So this is the variables identifier or the variable's name, a number. It's accepted since it's all alphabetic, starting with an alphabet and we declared the antigen. So this number will hold the value that must be an integer or integer it. So let's take an example of grey. So we will declare integer variables. So integer is a data type that age is the variable's name. We put the semicolon and that this variable age will have a value to a 2020 is what is an integer. So everything is good. As for it if we want to store at best seven lumber. Now. Yeah, which I mean that any number having decimal point as 3.51.76, such numbers we have a datatype called flow. So in order to declare a float or a decimal number variable are flawed. That event we will say as the integer, as we said, we will put that data type which is the slower, the variable's name, which is weight and sacked Upton and semicolon others, some examples, lot, lot Aboriginals. Okay, so here are three examples. Let's say here. The float is the datatype, the average is the name, variables name, and we put nd as a valid. The average variable will have a value of 70.5, which is what? Which is a real number. Decimal number works. That's why we use the updated type flow. But keep in mind, we can also start an integer in a float variable, since we can write the integer as a float. So a float number, an integer which is 17, can be represented as a floor number as rho that 17. Ok. This will be the most datatypes use in order to store numbers. I wouldn't just be mentioned in the other data types for numbers. So that if you see them in any court or side, you have a small idea about the. So we have the double, which is like flawed, but that the occupies doubled the memory of flawed and hence it gives a better recession. And we have the lung, which is also the same as the dot occupies double the memory, but this longest four the integer, so it occupies double the memory of integers. Now we move on four for one to store a single character. In a bad event, we will be using a data type called char. So as we said earlier, also the normal to declare a char variable, we will put the datatype which is a chai, and the variable's name, which is a great name, spot. Let's take an example. So if I declared a character variable, which is the dike chart as we see that variables in its class, Saxon and there's the underscore which is also accepted. Then we say that class action, it has a value as an a which is a single character. So when school and we didn't know, and we did not forget the semicolon. But for a character when we are putting the value. So as here, as we see here, when I'm putting the value of a character variable, we will put the value that we need between two single quotations. So we do not put glass underscore section equal to a. We will see later on why. Just keep in mind that when we put the character variable, when we're giving a value to the character variable, we'll put them between two single quotations. So now, after we learn about how to declare variables within that, the data type and then the variable's name. Why don't we go to call blocks and declare some variables. Here we go. Call plugs, up and five folder. My project is called subculture. So hidden the me. Okay? So as we knew that when I want to declare some variables or in any C program must start with the VAD or would the Including the libraries, so strike the library's quickly hashtag in lieu of these stdio.h. And then I'll go into my that we sent a second structure of a C program. We have the main function, so it's main or we can say avoid main, void. Main will often these. And then we append a bracelets. And here we are. Now inside our main function, we'll declare some variables. So let's say we have an integer. And the jerk variable here after they are in the data space there. And let's consider that were named as a, What do we still need here? It's a semicolon. So let's write another integer, b, for example. O. If both integers that want to declare are of same datatype, we can put them on the same line and save some space. So integer a will remove the semicolon, put that comma, and put the second variable's name b. And then a semicolon. By that we defined two integer variables, a and b. So now what if we want to define the number of variables? So we will be using the float data type. And then let say there is a space and that say the variables names I, x comma y comma restaurant will end with a semicolon. So here if we define the three decimal numbers or three decimal variable, variables having the name X, Y, and Z.
6. Arithmetic Operators: As for this byte, and we'll be talking about operators that we use in C it out with. So as we all know the aromatic ones, such as addition, subtraction, multiplication, which is symbolized by the style shift number eight, the division. So if we want to give some examples, let's start with that addition. So the addition and say x equals two plus one. So x will have a value of three. Of course, the standard color subduction abduction X equals three minus one. Multiplication x equal to two times seven, and the division X equals eight, or with two. These operators are used on integers, as we saw here in the examples, but are also used on flux. So we can say x equals, equals to 5.7 plus 0.8, x equals to 9.2 minus 8.7 and accepted the multiplication and the division. So these are the arithmetic operator may seem familiar to you, but now we will see a new operator that we use is called mandala, okay? The Monday operator, which is symbolized or presented by the percentage sign. So what does this operator and do? What it does is that it gives us the remainder of any integer division between two integers. So as you all know, any regular division. So if we say, so for our saying a divided by b, we can write it as a equals B times the quotient of the division of a by B plus very mean that i. So this expression will come in handy using this operator. So let us give an example to make it declared it. So we want to get a, let say, a five modulo two. In order to get the answer of five modular tool will make the regular division of five divided by two. So let's demonstrator five-mile divided by two will give us a caution of forward bed of Stu and remainder of one. So from I now write this division as the expression here. We will say that five is equal to two times two plus one. So hence, since the remainder is one, which is an integer. So we'll say that five modular two is equals to one. If you want to give a more demonstrated examples. Here, let's take nine mother your three. Since nine is divisible by three, as we all know that three times three gives us nine. So the non-modular three will be 0, the remainder will be 0, which makes sense. As for now, let us turn some modern examples on card plots and see this, these equations. Bacharach. And let's run new examples. So let's go to gauntlets. Here they are. This is our, he is God. So since we said that modular gives us the integer domain there, so we'll be using integer variables. So as a and B. So we'll say a is equals to. Let's make suits first 15 modulo, which is just faculty T5 to semicolon, and I forget the semicolon. Let's say b is equal to 17 modulo three. Okay? So we want to print these variables in order to see the answers. This function that I'm using now, we will be talking about it and embed. So just briefly just makes, allows us to vent the answer. So we want to print a semicolon and a plan B, the same me, semicolon. And let's go either you can now add restaurant. And then they will ask you if you want to build the program or directly account just bottom built and Brown CEO are the aerosols. So a which is five, model2 is one. So our break above earlier as quadratic and Simon de mother three is still by this. Now you know, the Muslim operator.
7. Assignment: If we want to give a value to a variable, we will be using the assignment operator, which is we use the equals sign to make an assignment. So we can say a is equals to b semi-colon. So here we are giving the value that the b value is holding to the variable a. So in other words, we are giving the value of the right side of the equal sign to the variable at the last side of the equals sign. So the Edo here from the laughter on dry the data. In an estuary mint. We can assign a constant value, such as a is equals to one. What help is equal to a hero or assigning a constant, choose one or the eight into a variable a. Or. We can also assign to a variable a value. What do I mean by that? I mean, let us considered Xt is of an integer did die and it's holding eight as a value. When we write y, which is another variable of integer data type two equals to Ax, who are letting y the whole value as x, which is a. So instead of saying y is equal state, we are saying, we say y is equals to Ax. Or we can assign to a variable or an expression including constants and variables. So we can say y is equal to x plus two. So it's an expression containing a variable and a constant. So whatever is the value of a to a replaced acts with the value of red. That's considered as it's eight. So eight plus two, z constant dancer. Why would have a value? Or we can say y is equal to two multiplied by ax plus a. U can be used all the operators that we mentioned earlier, a throne, such a code and the compiler. Let's go to our cold-blooded. Let's erase this. And ok, we included our library, our main function, which is the starting point, represent the starting points on the program. Sarah Twitter is our starting point, when is our main function? And then it will start executing statements inside of it. So inside of it, we will declare, we will define our variables. So if we consider it an integer, a, comma B, or let's say uppercase. So as we said earlier, these two variables are differences the C language as case-sensitive. So we declared two integer variables, uppercase and lowercase a. And then let's say. A lower case a has a value or we want to assign it to a constant. So a is equals to five. Gay. And that's say a, the uppercase a is equals to the lower than lowercase a, last seven plus seven. Okay, so here we're made to assignment. The lowercase a was assigned to a constant. The uppercase a was assigned dynamic expression of valuable and a constant. So let us print this two variables and see what values that they hold. And so let's build and run to the small value a. Then the lower case a has a value of five, and the uppercase a has a value of 12, which is five plus seven equals done what? We wrote another assignment and said this is a equals to capital today. And say a is equals to a plus two. Now let's run the long run. So you see now the lower case a has a value of 12, since you assign lowercase a to have the value that the uppercase a hat. And then we added to the uppercase a two. So now it had a value of 14. And you can't. And more let say o, we can declare a new integer. Let us be OK and stay. B is equals to a uppercase a dynasts for last, minus do. Ok. Semicolon. Let semicolon London run. Oh, I forgot to print the value effect. So let's print the value of V. Okay? So now b has a value of 66. If you calculate that, you will see that as now, after we learned that assignment, how to do an assignment where I'd be able to declare the variables with initial values. So when we are defining two integer variables, integers a and b. And then say that A's a is equal to two and b is the console for it. We can directly, this is all equivalent dual integer a is equals to do so a, it has an initial values that do and B had initial four is equals to four. And that's all in one line. Or at the same afar using other data types such as flawed. So we say slow to float to the variable's name equals to 3.5 comma and other variables name artistic spent seven semicolon.
8. ASCII : So now, if you recall the example that I gave when I explained the child did the die. Okay, so I write it here. So datatype char, class, underscore selection is my variable name, UK. So recall a spine that had ever been to this valley around the latter Gore section. But as we said before, when we were assigning valuable, valuable, allotted a single method, a single character, we must put it between single quotations. We've seen give quotations. So that if the compiler really that as the latter we've types, I'm putting the quotations would seem as a, is a variable. Which makes sense, right? So if I didn't put my single quotations, it's what seemed like I'm assigning a value to other value, but it is undefined. So if we tried to build up, down or forget all our work called the blogs will give us an adder, adder, a undeclared students and dysfunction. So normal compiler, it's considering a, that's about it. But we do not want this. We want a as a character. That's why we put single quotations between. So your GoldieBlox is always good to save today in case you forgot the Twitter mind. But there will be an issue if there was a really a declared variable call. So the compiler will, will, will take the value of a and put it into class action. While in reality, you mean that glass section must have, I think Girl, character value, Lapid air. So keep that in mind, paid attention to procure single quotation. But over, I will talk about something called ascii. Ascii is an abbreviation for the American Standard Code for Information Interchange, which is a character encoding standards for electronic communication. So let us give an example and from it we will understand what that ascii do. So God deal called blocks. And that's consider, we have a character variable called bluff. And let's consider we have a character variable valuable called ACT. Another one, 2y. And the one we, David, let's suppose it's ducks. We gave it lettered edge in single quotation. So whereas, while we gave it the number 65 do not be surprised. I know that y is a character and a, suppose b, and suppose to give it a character, but you'll see in a minute. So Semicolon. Let us print this book characters. Semicolon. That's when it seems like both characters have the same value and uppercase. So hub, both variables displayed, collated. And here is what ask you. It gave each character a number. So the uppercase alphabets has an ascii value from 65 to 94 to 90. So used so that the uppercase a is 65 and that's y. Y is equal to 65, showed us as an edge. Since y is a character. Lower-case alphabet has an ascii value from 97 to 122. You can see all the characters. Ascii value. Just type on Google ascii value of characters. And you'll see the more, not only alphabets are MOOG's character's own displayed. All of these have character, an ascii value, such as the ADD has an ascii file and 64 that the apostrophe as an ascii violet 39, the underscore, 95, and etcetera. I will go back to a current flux and show you something. It is does. Let's say I wrote after that, y is equal to y one and x equals x plus two. So you'll see that now x has a value of c and y has a value of V uppercase, since x and y had both capitals, uppercase a having one, do why it became 66 sixties texts is the ascii value of B, whereas $65.67, which is the ascii value of c. So you can make an assignment using also arithmetic operations. Operators. Using the ascii values of characters.
9. Output function printf: Now, let us start with functions. There exists two types of functions that we will be dealing with. We have the output functions and we have the input function. Both functions of both types of functions are defined in the library stdio.h, as you mentioned earlier, which is abbreviated or stands for the standard input, output had the file. So we will be starting with the output functions. These functions are used to display information on the screen. So as you can realize from the name of an output function that gives the displays and information. As an output. We will be starting with the function that is called print f as Esau earlier, I have been using it a lot in order to print my variables that we were dealing with. So the syntax used for this function is turned off and then you open the parenthesis. And then the text or the format string that you want to display on the screen will be put between two double quotations. And of course, the statement must end with a semicolon. So we will be printing some texts now to show you and cold bloods. So let's go called plugs. And often my main, ok, so this is the default program as you all know that it is. Okay. So as you remember, I said that our first code to write will be greeting the compiler back. Because when we run the default program that greeted dust, so let's do that. Of course, starting with our C program, you will must include our libraries. And as I said, these function, the print as the output functions are defined in the library, the stdio.h. So I will include this library hashtag include stdio.h. We put our main function, void main, opened on bracelets, and here we are. So we want to print when agreed the compiler bug. So let's write. Then we will be using our output function that allows us to display information on the screen, rent us up in the parentheses, double quotations. And here you write your text. So from all of us. God blocks, and of course, our semicolon. So let's run it. And here it is. From all of us are local blocks. So as you can see, we wrote our first program, we greeted the compiler back. So let's write another program with two print F statements. So let us start with by saying print and change just the input. My name is shot. As you saw earlier, I was putting the backslash and then at such a symbol, it represents a new line. So when I put the backslash and between and after my tax, included between the two double quotations. This means that when the statement is printed, moved to our new line. Okay. Now another print, let's say or it could take 30. I wouldn't double quotations. My age is when the US also backslash. And of course our reassembling, it selects dry, our print asked Would the backslash n and without them just an audit to see the difference. So I'll start with the backslash n. So here the FED dx is o, no new line. As you can see, let's try without the backslash n. So as you can see, what texts were printed on the same straight line would without moving into a new one. So here is the function of a backslash earned. So now, what if I wanted to change my age from 20 to 50, for example? I will be looking to my program where every time we wrote 20, I will change it, do 50. So let's do that and then run it. Okay, so it sounds good. My age. So I just forgot to put my backslash and so but my AGL is printed that my years old. So everything team at school and fine. But the problem will be, what if we have a very huge program composed of thousands of statements? So we'll be looking forever in order to change every 20 to 50. Here is his word valuables, Tom and hand. So let me just put back my backslash, Ernst. And let me declare an integer variable since ages and ended. So we'll say integer and declared my variable called age. And say that h has an initial value to one thing. Okay? So in a print f, we will say my age. Instead of writing the number will, will be using a control string, which is percentage d. Ok. So my age is percentage d, years old. Backslash n. Close the double quotations. After the double quotations. I wouldn't replacing a comma. After the comma, we will be putting the variable name that must, that its value must be taken and replacing presented D. So in our case, it is h. So the value of h will be taken and placed in present. Instead it's presented today. So let us see. Here it is. All good. What statements add on a new line, and my age is 20 years on. Okay, so VS. So much helpful for running a lot of statements. Here. I will call this temple. But let us say, I'll write another print and say, my age will be in the next five years. Five years semicolon. So the column, okay, so here, there must be a value where, where our age is changed. If I want to put inside the presented my age, but after five years, so my age must be added into affine fuse. So let us declare another variable. Also an integer. Let us say H underscore after five years. Here. Age underscore. Five years will be equal to h. Last, write. Instead of writing, if I wasn't choosing a value of a, I wouldn't be putting Q. 20 plus five. And every time when I change my age ten to the 20 into another aid to Taiwan. So here I'll put age and every time we wanna change, I'll just change the initial value. So let us say here, I'll put H underscore and after five years, I went summary column and let us know that. So here it is. My name is Bashar. My AUG is 20 years old. So because H has a value of 20 and then my a2 and be in the, in the next five years, 25 K. So what if I changed my H initial aij into 15? So it must it must give me a 55 after five years, the heeded my age will be in the next five years, 55.
10. Output function Puts: As for now, we will move to another output function which is similar to print f, but has a backslash built in it. So when I mean by that, is that when we use this function, it automatically, after it prints the requested that it points to a new line. So this function is called puts. It has the same syntax as print f as you go and see redial. The name of the function puts parentheses, double quotation, and any free text that we want to display or threat. And of course the semicolon. So why don't we see this function in x? So let us go to code blocks and dry dead in a statement and execute the block. Okay, so we included the library is our main function. So let's try it for example, using this function buds, parenthesis, the double quotation. And let's say, Are you enjoying this class? Or Schumer? No need to put a backslash earn and the semicolon. So not us random buildup. And here it is, eggplants. Are you enjoying this class? And as you can see here, there is a new line. So what if we put backslash n and we run it? This is a, this is equivalent to as if then with Darwin backslash and the, as you see here, there are two new lines. Birds function only accepts a free text, so we can write inside of it any text that we want to print. It does not accept any format string or text that includes control string. So if I put, for example, I enjoying last, I wanna say one last percentage d, for example, presented to d, and let us declare an integer, variable, integer last, minute, last. So let us try to run it. And the compiler will give us era too many arguments to function puts. So the arguments what or what we call arguments, are the value that we place after the commons here that the function takes as an input. So here, function inputs or any function when we are putting the values of the gamma, they are called the arguments. So the number of arguments afford bots are 0, does not accept the have any arguments, and thus does not accept the hab and format string. That's why, but only work with pure tax. So if you want to print your tax, use bullets to save yourself some time. Instead of writing backslash. Why don't we present the same text using print f, c. Are you enjoying this? And I will put backslash, backslash n. Then we will see the fence, Lusher, ochre and alternate. So here are the goods. We put a backslash n, but it moved me to the next aligned with print f. That printed our tags, but that did not point to a new life. So we can say as equivalent to print as with a backslash and included between the double quotations. So by this function, we are done with the output functions. And now we move to the input functions.
11. Application: So now let us make our program more complex, so vital if I want to talk about my grades, my compared to whatever it is that degree I will get. So I would write one sentence, end up cleaned up that I wanted to display them together. We will change it and to control strings using control strings using variables. So I will the 17.5. So the evidence is 60. So getting, okay. So this is whether one up to n. So if I want to change it and dealing valuables, I will go. And by the way, we can always, declared value was unaware, but for the more organization, I prefer to put them at the beginning. So might wave. It's 17.5. So it's a lot of the kids declared our flow flawed. Initial value is 17.5. It is also a flow. In our case it is 16 May. It's accepted to be as an integer. And other gates and then evidence maybe afloat. So let's put the float. So added equals 16. And I were denounced. Character would last value but also equals, as we said before, that tectonic dead, we're going to assign the value that's in between single quotations. So here we defined our F3 valid was that we went that we will need an hour days in our rent off. So far I've changed this. Split over backslash, backslash n. So now write another print using the VAT. So we will say is, instead of using the numbers we will use as a control history. So in case the fur are using a flawed valid with the control strain wouldn't be percentage. I wouldn't be showing all the constraints. Strings were older than that we will use once we are done with this program. So migrate this percentage. While the average, the average is also presented, she goes It's float. So b is a character variable. So the control distinct, but I've kind of just see degree. And of course, our semicolon. Okay? So are we done? Nobody knows. What did we forgot. We forgot that after our WK isn't, we must edit, present these percentages. What value they must think. Okay, so after double quotation, I must put what the value of the def percentages and most Day. So the percentage of various must dig the value of the gradient variable. I've added tumulus day, avid edge, wherever. Last one getting. Now we're all good. Okay, so let us run our program. So you see what statements are same, the printed the same sentences. Rug rate is 17.5. The average at 16 and I got to be migrate is 17.5 of docking with the zeros and so on while the other logistics. So I've got a bit, okay, so about these, is that the percentage of control the strain has by default six non brisk different after the decimal point. But that there is a way in order to bear size a numbers after the decimal point. So if we want to eliminate all the zeros, so I have just 1.1 number after the decimal. So we're right, percentage, 0.1 here. Percentage or the Euro that's there because we do not have any numbers after the decimal point. So let's run it. And you see migrate 70.5 while the average is 16. So we've got through the folders here. So resizing the number of points, the numbers after it, the point that you need, you can put them between the percentage and and and AEF were with the point under number you want. So if you want three numbers at the destiny will be putting zero-point. Point is three, and so on. So far, whenever a change, if I want to display weights, average degree for another person loves us, you just need to change the initial. So if I wanna display pick grades for another student, that's the way that it took as 19.5, the average. Is 7.2. And does he get degree? Okay. So I want to change this. Ok. So you say Dan migrate and 18.5 for the average 70. And so we've got the elite. So here, why did over 0.2 doesn't show up? Because you are stunned. Putting our point D here. So foreigners showered, we must pay attention to dark. Let's close our command from the case and let's put it 0.1. Then they don't. Okay, so you see more varied is 19.5 on average 70. And I got a okay. So this is all. Now. We'll move on and show you the control strength that I'll be, that we will be using for all variables before datatypes. So let me show you. So for integers, as you saw, we had to present the four floats you have presented. For characters we have presented stay for a double percentage and ARF for long. And the and also we saw that for a whole new line. Backslash. And and here's something you knew for a horizontal tabulation. Does is recall backslash. Do they'll show me what do I mean by a frame or a dental tabulations. So let's go back to our call blocks. So write, print using the backslash days. So let me just displayed valuables, percentage, backslash, backslash stay presented the backslash. And you learned. And then we'll get rained evidence for a degree and a backslash. Let's run it. Okay. So you see no different 5.217 and the horizontal tabulation, the Dodd Frank doing lots of spaces. You can use backslash d in order to put space in horizontal space between the numbers. You can achieve that by backslash.
12. Input functions scanf: So now as we move to the input functions, our famous input function that we use to read values from the user and store it in the variables is called scan. Its syntax, as you can see here, scan parenthesis, the double quotations. Okay, so between the double quotations in a scanner for any input function, it accepts only format strings. So what do I mean by format string? The only we attack that to have between the double quotation, the controls to ensure that, for example, the percentage, the percentage off, it depends on the variable that we did. So accordingly will put after the double quotations that comma and a list of addresses variables separated by commas as we saw the arguments in the when we, when we use the control strengths and wrote the argument or the variable's name after the occupation separated by a comma. Here is also the same. Will be taking an example, so on. So this function, when use, it will wait for the user to enter his want that value to place it in the specified place or value. Okay? So if you're wondering, what do I mean by addresses variables? So an address of a variable, which is obtained using the address operator just before it variable's name. Okay? So the address operator as represented by the end symbol, which is as you can see here. So we put and then the variable's name. So to make the image more vivid and closer, See you guys. Nothing better than taking an example to gather and seeing the scanner for an action. So let's toggle called blocks that arpanet, the blocks. Okay, so, okay. So create a new project. Okay, here's our pants back on live. Our library as time include stdio.h, void main, often the place. Okay. So we will write this program that asks the user to input two integers and it will display their stuff. Okay? So we will ask the user to input. And two different values. So we need two different integers. Since I specified that we need to integer. So we need to declare two integers values. So let's just start integer. Let's call them x and y. Ok? And because we want to display their sum, so we'll take a third integer variable that will be the sum or we'll call it sum. Okay? Since the addition of an entity and then empty jet as advantage. So that's why some of them integer also. So after we declared three variables, we will want to be user to input a value for the x and y. So first, we'll print for the user a message to let him know that he needs to input a value for x. So print double quotations. A player's input. Your first integer. We assume that the user knows that this program is to calculate and the sum of two different entities. Okay, so please input your first integer, a corner and the backslash n. Okay, my semicolon. And then I'll ask the user, I'll use my input function scan f in order to store this integer that the user will input. So scan paranthesis double quotation, since we are dealing with integers. So we need to put presented today. And then a comma, this percentage d. We said that it must be stored, or the integer that the user will input must be stored in acts as the first integer. So as we started here, it must be it the address of the integer that we want. So they address operated era and x. That's our semicolon. Okay, so when repeated bag that same statements for the y. But now I'll use puts to justify the change. Since we're dealing with tax only tax the please input your jacket and the dirt. No need to put backslash n here because we used birds. And then the scan is ten and y k. So here, if we run, run the program, we will see that until the statement that user o, we will have to saved integers to save dry earliest enacted law. So why don't we run the program before we continue in order to display the sum. So. Okay, so please input your first integer and it's waiting. Ok, so here it printed this message and then now it's own scan off. Okay? So here the user or the compiler is waiting for us to input. I use a value. So let's say the first integer is five plus five, and then enter. Okay, so now five is stored in Acts. Please input your second integer. Let's say we're talking eight, K through eight. And now the program finished. All good. Okay, so now let's continue. The program will display their sum. So now we need to take the sum variable. Sum is equal to x plus y k. So now we have x plus y is stored as a value in sum. We will display the sum. So in order to display, we'll use print f mass, print f function we cannot use, but since we will use Control strength. So print the sum of the Xj presented, the it resulted is present. So what I mean by decentered, the first pretend I want to replace it by acts are going to say the sum of x and y is the sum. Okay? So the sum of the first percentage d is Ax y, and the third percentage d is four. We put a backslash neared. Ok. So let us see. Okay. So here it is the inputs 58, and here it is, the sum of 58 is 30. Okay? So Moreover, we can join these two statements, end or these false statements then to state. So we can ask the user to put, Please input two integers. Okay? So we'll ask these two, input the two integers directly at the same time. Okay, and then in the scan, full per percentage the space presented today. And we'll put the address of x, address of y. Okay? And we will erase this. And let's run it. Okay? So pleased, input two integers and put five. And the sum of 58 is 30. Okay, so by this you save some time. Moreover, also an audit not only saved some time but also some space. Instead of declaring a variable sum. Rekha, lived this variable, we do not need it anymore. I will remove this also. And instead here abstained some of presented the representative presented xi, x, y, and sum. Instead of saying some merchant actor plus why? We directly can say here AX plus Y, we can use the automatic operated as an argument and the commerce without austere enron. Okay, so five, The sum of 58, sturdy. Nothing. Nothing has changed. Okay, so oh, I forgot to tell you. Let's read on the program orchestra here. When Please input two integers, you can place each integer online. She lets say five. Okay? And third down, compiler will wait for you to input the second integer, since we put here two addresses. Okay? So the computer or the compiler knows that we need to add two values. So the first 15 and then eight. And or you can on the same line as I did before.
13. Input function getch : And such a function, another input function called gatt. Such a function, unlike the other function that I defined in that std I ordered aids, this mountain is defined in Konya that a2, which stands for and it Council input, output header file. This is a new liability that we will see. Now. The syntax of the gods is the name of let gaps with an open and a closed parenthesis with no, with AMT arguments. Okay? Such a function, erase all the inputs that are still in the stream and wait for the user to press a new key afresh skier. After the user presses. Icky dysfunction, whether occur a will return the key and store it in a character variable. In a character variable. So if such a key is used as integer, we will see the ascii value that corresponds to the to the press gear. Okay, so all will be taking an exam then in order to make it more clear. And how this function words. So let's go to God Lux. I'll just create a new project. Quickly. Call it finish. Okay, here it is. Okay. So in this exercise, since as we all know our famous library, the hashtag include stdio.h. Ok. And since as we said earlier that the g2 function is defined in a newer library called connoisseur. We will include this library they do in order to use this function. So Konya dot h. Okay? And then our main function, void, main. And up in the place. So now we will be writing a program where we will ask the user to input an integer and a character. And then we will ask the user to input another integer. And after that, we will ask the user to input another character where we will be using gaps. So let us start, since we will ask the user to input two-character add two integers who will declare two integer variables. So a beer. Okay? And since we will be asking the user to input two characters, so we need to declare. Child variables. So a child, let's say D, DND. Okay, so now we will ask the user to input the first integer. So we will print on the screen rent so that the user will know that he needs to input a character, an integer, not a character. Print f of k. Input, one integer, backslash n, and a semi-colon. And then we will use our input function scan app. It says it's an integer, so the control string S percentage d, and it will be stored in the address of a. So by here, we guarantee that the user will input our integer. Okay, so now we move on to ask the user to input a character, the first character. So print hath. Pleased. Input. One director occurred, backslash n. Okay. Scan. The control string for a character is presented steam, and then it will be stored in the address of the d. Ok. So now the user input a one integer and one character, gay. So let's ask the user now to input the other integer. So old soap layers input. Second, the second integer. Backslash and scan. Scan AF, since it's an integer represented 2D and the address of B. Okay? Now, we will ask the user to input the last character, Lee as input, the second director. And now here we will use our guts function. So how do we use it? Since as we said earlier, that such a function will return that breast key and stored it in a character variable. So we'll say e is equal to catch. And just like this. Okay? And then we will print in ordered to see if the input connected here. Okay, So we will print out. E is equal to percentage c as a character, and E is also equals to percentage d. And we will see what value it will gives us. Okay? And both we will, they will be corresponding four E. I know that both that E if the character and here I'm using it as a controlling for integer, but we will see the value that it will give that and we will explain. So let's run the program. Okay. So just up and faint also. And in order to explain in details, ok, so near the band. Ok. So please input one integer. So we, let's consider our inputs have been dn, okay? And I ended up guy out. So here, if you'll be surprised, why didn't it wait for meat in oil? These two input another character, yeah, input, my faith. And a directly printed test, and then printed the other statement that input the second and digits. So let's see. So since on the screen I wrote 17 and enter. So now if I am considering the input output stream, okay, so I have but 17 and an aunt that are presented to enter with an ad like this. Ok, so the first category, the first integer web devs have Indian. Okay, so if I'm, let me that are present here also the moment. I mean, if you need to understand more about these, you can watch my previous video about the hardware for compute that. It is under the title How to choose a suitable laptop. Okay, when I explain more about the umami mean and the other hardware components, okay, so in the mummy remain, have an integer called a. We have an integer called b. We have a character called d, and we have a character called E. So they'd read once I input the 17, okay? So a will take the value 1717 will be stored in a. Okay? So then the input opposite dream. This was taken, but this is the enter here, still, still there. So when the compiler asked me to ask the user to input a character directly in the end. But output stream, we have still the enter. The compiler moves down here. Okay? The value of add debt will be taken, okay, and store it and D. So now D will have value of an enter which represented as a, as a new line backslash. Ok, but as a character pointer, since D is a character to put the single quotations. Okay, so now we move back. So please input the second integers. So let's say it's 123, okay? And so now in the input, output stream, I entered 123. And we have the, OK. So the 123 is taken and stored in B. So a and B we have 12. Okay? So here it did not make the same stub, the skip character since we used gap. So once gulch as use get written is not shown on the screen. So once the gods, the zoos, okay, it will erase all the inputs that are still in the output stream. So in this case, the end will be erased and we will have a new input. Then put output, the output stream and the empty one. Ok. So then it will be waiting for the user to press the fresh state that I applied to. Okay, so here it is. It printed. E is equals to two, d is equals to five. This is our last statement here. Print E is equals to E, the character that item put which is due and is equals to 50. So before talking about the 50 is two and the output, the input output stream. So two will be stored as a character value. So, okay, so between two single quotations, not forget that since it's a character, when I'm using it as a, as an integer. This integer here that will be printed in our case, f t represent the ascii value of two, okay? The ascii values that correspond for the numbers start from 480 has an ascii value of 48, and so on, you move on. So now, after we learn how our output and input functions and you came across the ascii value. Why don't we learn how to print the ascii value of the character that we want. So let's declare a character. Okay, we'll ask the user print. Then put any character, scan half gama and see it. And then we will print the ascii value of the character that the user input. So we will say the ascii value. The ascii value that corresponds to presented, the, is presented the coma, the first percentage C correspond to c And the second pretended C, D corresponds also to see. So let's run the program. So let's say I want to see the ascii value of i, lowercase r, okay? The ascii value that corresponds to i is one to five. Well, not really run that again and see the ascii value of nine, let's say the ascii value that corresponds to minus 57. Okay? So this is a program that you can use if you want to find out the ascii value of any character U1. And later on when we learned about the loops, we will be able to print all the ascii values. The ascii values, all the characters that we want in one program. And we do not need. So every time to stop our program and rerouted to enter another character. Ok. So this is what this back to ascii values and our new input function that we learned, the catch.
14. Math functions : Which I mentioned whenever we will be talking about some functions that are defined in the math library, which I mentioned when I explained the library's action. So first of all, we will include this library. So hashtag include age. And of course, also include with a mist liability. The stdio.h. Now we included our libraries. We will state our main functions of Wayne voice mail. Then we'll open the place. Ok. So as for now, we will start with our first function that is defined a demanded H, which is the function that gives us the power of a numbered one. To calculate x to the power y, we will be using a function called path. So this function has two arguments. It takes as a footnote, bags and Lord. Why? In this order? Let's remember that an integer can be represented as a flow. So when I'm saying Here, float x, float y, they can, we can use it and integers. And dysfunction as an ordinary, nonetheless, tested either by labels must be of type. Float is the function. So if they haven't been bad, It was the daughter of integer data types. We can still use them today designs with adult bow off to afford, we can still use the dysfunction day eggs. The first argument is debased, and this, and the second argument is the password. And it returns. They answered. It must be in a flow. So in order to use this line should move and declared float variable. So let's say float x, OK. And let's say x is equals to two. Gamow, let's say six. Okay, so due to the power, let's say, just to make it easier to be shown that works. So let us print the value of x and t and x. Let's build a drone. And here the 162 to the power four is 16. So we can write, we can declare lot X, Y. And instead of writing the entire function, let's say y is equal to Li. And so we centered our first presented to the school, while the second pit vented cap and the answer of typologies, let's put them drawn. So hated this. Power six is 300, is 729. Okay? And of course, as we said before, eliminate the zeros. Do I have to do that just after it, a percentage point. So why don't we make it more complicated using test function? So let's say I have three variables. And we will ask the user to input the value of x and the value of y, n, we will get the power of x. The value of x to the power y incident. Ok. So number, that will be the base. Then scan percentage of syntax float. If we want to make it an integer, we just need to put as an integer and how to use it ten but identity. So scanf percentage, we will put it in x. We said at the end. And that is equal to f of x, y. And this vintage. So here, my mistake, I put x as a small letter. Uppercase X. Uppercase. State-based, wanted seven. We'll do seven theta power to exploit dinner. Okay? Here it is our first function. Okay, so now we move to the other function that we will be using in the mouth that age. It is the square root function. So okay. So the square root functions from its name. It returned with the value that we put as an argument. So the square root, it is shared by function is called SQRT square root. Okay? And then we often depend that, and we can put the number that root, square root of n independent. But since we know that the square root of my number is probably a lot of patois. The square root of the square root of two is two. Let x is equal to square root of x, which we know it would be an integer. What live? First presented to deal with the square root of four is two. And also, we can do the same. We can ask the user to input any value. You want to calculate the square root of it. And we can the square root of. So this is the square root function called is a function that returns the absolute value of the input of the f. So f of minus two y. But it's to give us the absolute value of minus two, which is to say fabs of eight minus nine. So this one will give us one. So you can put any expression between the, between the two parenthesis to be exact numbers. Variables. Say, for example, if I have another value, x equals to, we can stay here. X minus nine and then print the value of seven. And this will be the functions. Let's move on. I would fold function is called now is a function that returns a function that around the node. So we gave, okay, so it turns out numbers, the smallest integer, which is bigger than the contrary, we have another function that the neatest, largest number, smaller than the input called load. So let's see. It rounded down, but it gave us two. This will be our functions that we can use. Functions inside the functions. So let's say we have float. And do I need to get y is equal to square root of both x? And the answer is three to the power of rated power x, which is e to the power two, will give us 99 is nine, and then square root of nine is three. So here you can see that we used oxygen inside function instead of using a lot of variables, but each one a value, declaring a bad evil that with the result of the power. And then another variable, D pointer fabs of then y, square root of that through, but you will be losing time and space. So here's our function. And let me give you a small recap of all the functions that we do. So we will start with the first junction, the flow of the exploit law, which is return x raised to the power y. The mention that here I wrote float, but then an integer. Since integers with quite a float, float, square root, float x takes on any value, any number, not necessarily on the float data type can be an integer. And a float, which is the square root of two times the square root of ax. The third function is flawed fabs, which retains the activity and value of load till float x returns the smallest integer greater than or equal to x. These two, it rounds up and then have floored with shooting technologists in digital less than or equal to o, which means that it rounds down. By this. These are all the function that we will live or the main functions. You can see all the functions also and that they are defined in the age. Just go to Google and type in functions and methods age and you can see them all. But mainly desired function times two will be using mostly.
15. Incrementation and Decrementation operators : As I've said before, I've said before about the operators that we use such that the addition, subtraction, multiplication, division, and modulo n. They are that is operated that we saw. In scan. We will introduce operator, which is the double pluses. Such an operator is called the incrementation operator, and it means that it adds plus one. So how does it work? This operator functions differently depending on its location. So when it's placed before the variable's name, as we see here. So we put plus, plus the variable's name semicolon. This variable's value will be incremented by one before the first usage of the variable. So to make it clear what I mean, let's take an example. So if I have a variable which has a value seven, and I said and is equals to plus the plus is equivalent to say that m equals to n plus one and plus one to increment by one before using it for the first time. And then make the assignment and equal to OK, so in such a case is equal to seven, so plus one will become paid and then the value of a of m will be given to it. So as a result will have unequal to aid. And it called straight. Such an implementation was done because the implementation operator was placed before the variable. However, we will see now what happens if we place the instrumentation operated after the variable's name? So here is a gamma plus plus. So when we put down blood incrementation operate after it the variables day. What will happen is that the variable's value will be incremented after evaluating the expression. So let's take the same example, M equals to starve m and is equal to plus, plus. This is equivalent to say M is equals to remake the assignment. And then after evaluating the value of this assignment, this expression we will add plus one to m. So Andrew will have the value of the sovereign originally doubted general value of seven, of which is seven. So n is equal to seven and is equals to eight. Which mermaid here. Since m is equal to m plus one. Let us take an example thing, both operators. Thank God the blocks. Let's go to God blocks. Okay. So first of all, we will include our library. These Stan include stdio.h, void, main, and then we'll open the platelets. Ok. So now let us consider. We have two integer variables, eminent. So we want to declare this store integers. So integer and serving God. Okay? So now if we say, let's, let's declared this. Let's declare these variables with the initial value. So let's say m is also ecosystem and as before, y is equals to three. So now let's consider and plus, plus brent percentage. The percentage. Okay, so here it is. Now and has a value of four and M has a value of three. Since we put that instrumentation operator after the variables names. So as we saw earlier, the assignment, the evaluation of our multiplets and Dan bank implementation. Ok, so now why don't we make it a little bit more interesting. That's declared a third integer value b. And b is equals to plus, plus, plus, plus N. Okay, so here we use both places of incrementation operator, the after the variable name in the before the value with name into the pit. So let's see the value of b and a and b. So let's put one more percentage d and run it. And then we'll see together this expression is equivalent to one. Ok, so m is equal to eight and z equals four, and p is equal to 11. Now take this expression and we will simplify it together, or we will debug it together. Ok, so I'll often paint, right? So we have p equals two, plus, plus, plus, plus, plus, and right. Ok. So we said when we have the implementation operated before the variable's name, it will add one before the first evaluation. So this is the equivalent to say that, okay, this is equivalent itself. That first of all, we will have an, because the anode plus one will increment one. And then the evaluation will takes place. The assignment will take place. So P is equals to last and then will be incremented. Okay? So if we see and had a value of three. So if we want to see behind the scenes what's happening in the memory. So if n has a value, and then and v, okay? So, and has the value three at first, and then, and then has a sub k. So and was incremented by one. So now and has a value of four. So a three will be crossed out and it will have a value of, for me use another color. Okay, we'll have a value of four. And then p will be ampere plus n. So at this point and plus seven plus 411. And then we will be incremented by one. So seven has crossed out and we have a ok. And that what we got when we ran the program, right? And had a value of four, um, had a value of eight and p has a value of a life. Now what F3 tries to improve also. Ok, so we will declare an integer variable q. From this point, we will continue. Or we will make an assignment Q is equals to M plus, plus, plus, plus and plus plus. Ok? So this values of m here will be taken from the values that they became after this expression. Though, we will see, we will do, we will take this expression and Soviet step-by-step. But before let's print queue and see the value of q and q. So percentage, the percentage, the percentage today. And the patients and the semicolon. And let's run it. So here at this. Ok, so before that, let me put the backslash. Backslash credit lines. So here are the first print F, p, there are 84011 as we saw earlier. And then q is 12, is nine and N is five. Okay? So let's take this expression and studied step-by-step. So this paint. So make it thicker. Okay? So now we have an xz equals to four, okay? And is equal to eight and P is equals to 11. And this stuff, after this step, we declared that Q. So we will have a new box, fort q. So q is what? Q is plus, plus and plus, plus. So this is equivalent to say Q because both implementation operator or bought the variables to the assigned to date place first. So q will be gamma plus, and that term will become plus one. And lastly will become an, okay. So first two equal M plus N. M plus N at this point is four plus eight. So eight plus four is equals to 12. So Q will have 12. Ok? So q is equal to 12, and then n will become n plus one. So it will become nine and will become four plus one, so that will become five. Okay? These are the valid that we got from the problem. 95. Ok? The same expression and equals the anode plus one. We can say instead the fine equals dn plus one and plus one. Such an expression means the same as if we are incrementing by one. This expression comes in handy when you are incrementing more than one. So instead of incrementing n plus plus. And plus, plus twice. Okay? Where so it is equivalent to write M equal to two. This is means that AM is equal to m plus two. So these are some expression that means the same but with different syntax. So we have three equivalent expressions that I am equals to m plus one equals two m plus one is the same. And plus, plus or plus plus m, It's the same. In such a case. It is the same also if a widowed, um, plus equal to one. So all these three have the same function and do the same job. Here. It doesn't differ a plus, plus or plus plus, since we are not making an assignment. So either we start plus plus order n plus, plus both, they will lead to increment. I'm finally, because there is no as diamond, I'm not saying n is equal to M plus plus. So the value of a mistaken buyin? No. So I'm just incrementing. Why don't we go to code blocks and prove my point that these three expressions are the same. So let's go to God blocks. Okay, so I'll define integer thing integers x, y, that occurred and say aX plus, plus, plus, plus y is equals to y plus one. And that is equals to that. The last one is plus equal one. Okay? But we must give initial values for these three axes is equals to two. Y is equal to two in this ecosystem so that all these three variables will have the same value. So print as double quotations, percentage d are used, they are horizontal tabulation. Do you remember the backslash d, percentage, the backslash, the percentage d And backslash n comma and then x comma y comma z. When systemic God. So R1. And you see that the three values, the three variables have the same values, 3.3.3. All these three expressions are the same. Or just. That may also prove my other point about the plus plus ax, the implementation greater. Or let me say the notice the clarity. The drown. Now I forgot to fix it. Right? So and that's backslash. Okay, so they run. Okay, So they are or trays. So X plus plus and plus plus t, they are the same in such a case because we do not have an assignment. Okay? And that's what this back to the three equivalent expressions. As for now. Similarly, we will have the decrement operator, which is, which works the same as the implementation operator. But instead of adding one, it will be subtracting one. So obviously its symbol is minus, minus the double minuses. So we have the post decrement station there. Um, I'm minus-minus two here, it will give the value of 2. First thing, n is equals to a minus minus and then subtract. And I'll give an example about that presentation operator. So n is equals to minus minus. This is equivalent to saying M is equals to a minus one. So we subtracted one from mom, so i'm became sex. And then we did does diamond unequals to arm. So, and it's also equals 2x guy. So it works the same way as the incrementation, but instead of plus, we have the minus. And the, of course you can try some examples and in called blocks. So let's go. We'll keep days or just change the values. Why don't we ask the user to input some values for these variables? So okay. So do you remember how do we ask the user to input? We will use our input function which has gone up. But before putting scan healthy must dial the user that he must input an integer. So we must print on the screen, print input an integer. Box sludge. And of course we can use the puts scanf, percentage d and the others operator acts. And then let's say y is equals to Ax minus minus zed is equal to I plus, plus, plus two. Okay? And finally, let's say t is equals to Ax diamonds. Why? Plus x1? And we'll print XYZ at D. So belt. Oh, I forgot my semicolon. So built up guy. So input an integer and let's say I gave a four dean. And so access 13th since we have the fullest degree mentation here, so x minus minus. So we will have the assignment done first. So y is equals to act, which is 14. And then with the DiClemente, DiClemente of Ax, and that's it became 13. Zed is equals to y plus dou, hence it 16. And the Z equal to 13 times 14 plus 16, which gives us 198. That's all.
16. Casting operator : Okay, so now we move to the casting operator. Such operated it allows us to convert a value from one data type to another the back. So one does such an operator looks and handy. We must use such an operator when we are mostly dealing with integers and division of integers. Because as we will see soon in called the blogs and division of integers may result in a float. So let's go to called blogs and see the effect of casting operator. Okay, so undeclared to integers, to sex, because sex and equals to 40. Okay? And I'll declare a float c, where c is equals to earn divide by n, okay? As we all know, six divide by four is equals to 1.5. So let's print c and see what is the value stored in Syria. Now. So we said, okay, it on unbuilt. Okay, so you see, it gave us when C has a value of one, which is not true because as we said, fixed divided by four is 1.1. So in order to make sure that c will have a value of 0.5, we must use a casting operator. So we put before, after the equals sign will open the parenthesis and write flows. Ok, so this is the cast operator J. So returning back and divided by ad and then converted into float, store it as a float data type in C. So let's see the difference now. So you've seen now C has a value of 1.5. Okay? This is due to them in the Android declared as integers. There were declared as float. We do not need to use cast operator because the result of load divide by float is a float. Since the compiler deals with the result of any operation using integers must be integers. So what I mean that the addition of integers, integers, which is a drug addition, subtraction of integers, integers which it through with multiplication of integers is integer. It's also true for, but we face a problem. And the division of a digit, it's not obligated for the division of the integers to be an integer. And that, and this is what we saw here. That's where you reduce the cast operator. So now let's say I declared senior b equal to three for working it. Ok. And let's say is equal to p. Such, in such a case, since P is a float and I'm making an assignment of integer equals to offload and will have the value of the integer part on the VA, such a case three, so footprint. And that has a value of three. Okay, so you see I'm had the value of string and that it still other integral.
17. Logical operators: Now we move to logical expressions. Logical expressions are the expressions where two operands are separated by logical operators. So the logical operator that we used are, first of all, we have the less than symbol is all wind. We all know the symbols less than, greater than, greater than or equal, and the symbol of a greater than sign. And next to it you have the equal operator. The last phone or equals is also the same, the less than operator and the equal operator. O. You can put the equal first and then the last band. That's also same freak data. Then you can put the equal first and then the greater sign exactly equal. So in the logical exactly equal NSC Program and we write exactly equal double bolt. Not equal or different. Excellent military, more equal logical NOD. So if I want to just say not the exclamation mark, logical or the two straight lines. And the logical and the Dowell and operators. And these operators with the WMAP, okay? The result of these expressions are using logical operators will be 0, f at this false, and any non 0 value of its true, mainly we use one. So now the stick is some examples on each operator. Mc. Okay, let's go to cart blocks. Okay? So let's define integer values, integer semicolon. So with initial values x equal seven, go through it and write them above. The initial values. Y is equals to three. Ok? So let's say, let's say that is equals to x greater than seven. So that the code is greater than seven. And the value of that. So, so, so that's what I said before. The results of this expression is 0 or any non 0 value 0. If it's sports. Since X, the cost is not greater than seven. So this expression is false, so it will be 0 to z is equal to, let's go do that. X greater than y. So it's x greater than y, seven is greater than three. So that will be, so this expression is true. So that will be any non-zero value, which we said that maybe it's one, so that is equals to one. Encountered. Another example on logical operator. That is equals to Ax equal equal y exactly contour. So f x is exactly equal to y. This will be two. So seven is not equal to three, so that will be false. This expression is called, so that will be 0. And here it is. Continue. Now we have, we have the greater than or equal. Okay? Let's say x is greater or equal than. So since x is greater than or equal to standard, so this is the true since 77. We continue. Let say. That is because the ax equals to y. So here, such expression means that x is equals to y. So the value of y will be given to X. So now x has the value of three and z equals to x. What value? That has a value of t? So now let's try the different than or not equal y. Then it will be one. Ok? So let's try now. Equal different. So here I'm using the logical not. Y is equals to three. So it's non-zero values, et cetera. It's conserved through not the true. Okay? So it will be x will be given equal to 0, then will have a value equal to 0. And let's try that. And here it is. Okay. The logical or the logical, and we'll see them later. But these are the logical operators that you may use.
18. Comments: So now I want to tell you about a special block of God, The used NC called comments. Comments are not taken into consideration one square on our program with either just for our personal used personal note. So in order to write down a comment, we will be using a special syntax, which is the forward slash, and then an asked drag. There. This is the starting point. The end point will be an Aztec and then also afford where the slash, OK. And anything between them will be ignored. By theory. It will not be taken into consideration. So we use these comments in order to keep notes or to do stuff for later on, just to keep track of our work or to describe mainly the function of such a program that we're writing. So instead of re-reading all the statements of program, especially if it's a complex one composed of 1000 statements. So we can just leave a comment describing the tags. Also, we can use the comments that explains where we explain certain statements. Basically they are very, they are really beneficial where you can make use of them also to temporarily disable certain statement. And does an audit to see the difference in execution would these statements and without them. So I'll be using the default to program. So here, for example, I want to see the difference when I run the program with the sprint AF and without this train staff. So in order to do that, I will be putting this print f, the statement and our common, instead of deleting at so a forward slash and then an asteroid and you see that all the program change color into grey so that when I run the program now it will not be taken into constant duration. Once I put the ending point and asked trick and a forward slash, you see that it's normal color and between the two slashes will be ignored in execution. So let's say I run. You see here it does, it's empty. It didn't print hello world. Okay, so let's okay. So instead of deleting the statement or the couple of statement that we want to see. Their function in particular in our programs, we can just insert them inside a comment. And you can write comment as much as Eli. There's no certain number or a lament. And that's all what this bug, the garments they are, they are really beneficial.
19. Exercise lesson: Okay, finally, we come to an end in our editor class. Okay, so Irwin do one final exercise together and then I'll give you a project. I'm hoping that you all Handan. And if you have any questions, don't hesitate to contact me and ask me. Feel free to do that. So let's solve this exercise. So our exercise is to arrive at a C program that can delay the scalar product of two vectors. Okay? So this is our exist eyes that we want, our program that we want at ICT. So before everything, we will put up plan. What do we wanna do? So first of all, since we want to calculate the scalar product of two vectors to where we need to have these two vectors. So we will ask the user input do vectors. So a one-to-one, I declare our variables. We will need. Since a vector has three components, x, y, z coordinates, then we will have a further avenue factored. And three, a flawed variables. Thus we want, we will be declaring six float variables. And then we need the scalar product, scalar product, which we all know it. In case we have a vector V, vector one has a coordinate of x, y, z, and vector two has a coordinate of a, B, C, the scalar product. The scalar product of these two vectors inserted, product of these two vectors equals two X times a plus, why? Time is B plus zed diamonds C. Okay? So such expression, what it is, I will gives us a flawed our number. So we also need to declare a float. So now we will be dealing with Devin are flawed. So let's go on and write our program to lead to God. God logs include our library, gay stdio.h, and then our main function. And let's start. So as we said before, we will, we will need 6 thousand offloads. So I'll distribute damn slow. At first the vector, let say that has a component of Ax, y that flowed. The other vector has components a, b, c. Okay? And for the scalar product that it's a float also, let's say it's as been scalar product. Okay? So we will start by asking the user to input the coordinates of the first factor. So since it's a pure tax, I am, I will be using puts. Now k i star. So the coordinates are the coordinates of the first vector. No need to put backslash. And since we use, but so and then we will use our input function, scan AF. And since the fact that it has three coordinates, so we will be using the three floods x. Why is that so many percentage of return, percentage. And then the first percentage will be stored in Acts address and address of that. The same thing we will do for the second vector supports input of coordinates of the second vector. Of the scan. Percentage, percentage, percentage of the ad. The address of the address of the address of say, of course, separated by commas, then the semi-colon. So ten. Now here we ask the user to input the two vectors. So now we have the two vectors toys. And why is that a, B, C. So now we will need a, we need to calculate the scalar product. As we said before, that the scalar product is equals to Ax diamonds plus y times b plus z times the guy. And put into the scalar product equals percentage and the value of p. But here a backslash. And run the program, let's see. Minus steak. I wrote th acts and not that and I will not say it. Ok. So let's start the input, the coordinates of the first factor. So let's say the first factor is 21. This is X, the second coordinate as 14, let say. Ok, and then the third coordinate is 82. This input the coordinates and the second vector, let us say one, space five, fifty eight, ninety seven. Okay, so either, we write each coordinate on a line by pressing. And third, I will put space between them and the compiler will consider each numbered alone. Ok, so the scalar product of these two vectors, it is 8979. Then that's off.
20. Project: Okay, so now we've reached the Baltic taxon in our class. The purpose behind this project to make sure that you understood what I have explained earlier in the above lessons. And you use the knowledge that you acquired the watching my classes, how to declare variables, the use of variables, the input and output functions, etcetera in a program. So our, our product is a pretty simple. All we have to do is ask the user to input two complex numbers, stored them, calculate their sum and product, and then display them on the screen when that's all. With respect to our project. So I hope you enjoyed my class and die material expectations. I was helpful. So thank you so much for watching and I'll be publishing more classes about C programming, Sadat to improve more. And this is an awesome language. A lot more to learn in an ad. Who we'll be learning about. Loops, types of fluid that we have. Structures, how to write a function includes the function over in our program. Include the file, how to write the file, and a lot more, seeing in the next class. And thank you a lot. Again.