 Hello everyone. I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. So this is day three of C and C++ Bootcamp. And today also I am going to discuss few topics with you. So as you can see on the screen topics are mentioned. So I will be discussing about compilation process and what all data types are available in C programming. So these two topics I will be discussing along with few C programs I will be implementing that you can practice at your own. Right. So this is day three of the bootcamp and I welcome everybody who is joining this session live and like here with me to understand the concepts. And I appreciate those who who are watching the recording as well like will be watching the recording. So moving forward. So if you have joined this session like this session in the entire bootcamp for the first time. So if you want to know about me, I'm your instructor and I have used experience of 16 years and helping students to build their career in Salesforce ecosystem or in IT industry. So on this YouTube channel I am inviting lots of folks as well. And along with those I am delivering lots of content. So this bootcamp is basically dedicated for C and C++ programming languages. So the idea behind this bootcamp is to help BTEC students, those who are beginner so that they can learn programming in easy way. And second is non-technical folks who are from non CSIT background and if they want to learn coding fundamentals, so this bootcamp will help them. So be consistent because consistency is the key and do regular practice. So in every session I am explaining a few examples so you can just practice them and join this telegram group where if you have any doubt related to this bootcamp you can ask. And follow Sanjay Gupta Tech School on YouTube, LinkedIn, Instagram and Telegram and all the important links are available in the video description. Right. So now focusing on the compilation process of a C program. So this is very much important to understand what compilation process is. So if you are a BTEC student and you are appearing for any exam, so in that exam generally this question is being asked like what is compilation process. And if you are an experienced folk and you are not going to write any exam still you need to know the compilation process of a C program. Because in lots of programming languages we use compiler. So at least you need to know like in C programming how actually code compiles. So basically if we talk about the first step, so what happens first of all you need to write the source code with the help of an editor. So every time whenever you want to execute your code. So first of all you need to have an editor and then you can write your code in that editor. So in this bootcamp like I'm using online compiler. So in that online compiler editor is also available where first I need to type the code and then whenever I click on the run button. So internally compilation happens. So after that you just need to save your code and if you are writing code in C programming. So you just need to use dot C extension so that you can save your code. Right and after saving your code with dot C extension next step is basically related to pre processor directive. So so far we have used hash include as a pre processor. So with the hash include we generally define the name of header files right. So those header files are already available with C compiler and those pre processor directives like hash include are expanded. It means whatever content is available in the header file that is basically included in your C program right. So this is the explanation of third step. Now we have fourth step which is after expansion and intermediate code is generated. So basically that intermediate code is having the code which you have implemented and along with the code which is available in the header file right. Now once you have intermediate code so what will happen that compiler will be checking that intermediate code for errors. So as in yesterday's session I told you we have a compiler which checks all the errors in the program altogether. So if you have a compiler and you are compiling your code so all the errors will be checked and if there are any errors in the code. So those will be listed all together right. So if there are errors in the code then compiler shows them with the help of warnings. So now there are two things one is error and another one is warning. So if you face any error so anyhow you need to resolve that if you don't resolve that error it means you won't be able to run your code. And if we talk about warnings so warnings are ignorable. If you have warnings so it means compiler is advising you that if you improve your code so it would be better as per best practice. But if you ignore that warning then still your code will be executing right. So errors anyhow you need to resolve but warnings you can ignore right. So these two things you need to take care if you are writing code with C programming and next point says like if code is error free then basically it is converted into assembly language program. So this also you need to know like whenever C program is converted so it is also converted into assembly and that assembly language program is further converted into object code which is like written in machine language. So this is basically compilation process of a C program that is available. Now if we go forward next is execution process of a C program. Okay. So after compilation we receive the binary formation now that binary code will be executed. So what happens like after compilation process the code which we receive is basically known as object code. And it is incomplete because it doesn't contain definitions of predefined function. So in C programming like we have a library where all the definitions of predefined functions are available. So that library is basically linked with that object code and outcome of this linking process will be and executable object code right. So that executable object code you will be executing so that you can see the results. So if we discuss the last step so it says this executable object code is loaded in memory. Right. Memory means RAM and main function would be called by operating system. So this is the execution process that performs whenever you write a code. So basically if you write a code in C programming so these are the two steps. First one is compilation process and second one is execution process. Right. So first your code is compiled errors will be checked and your object code will be generated after successful compilation. And that then that object code will be linked with the library where all the definitions of predefined functions are available. Then outcome of this linking process is executable code and that executable code will be having main. So that starts execution and then main is called by operating system. That's why in every C program we basically write main function. Okay. So this was the theoretical explanation now moving on to the next topic which is data types in C and this is very much important to understand. So for beginners like those who don't have any exposure to programming so for them it is very much important to understand. And I'm going to reduce the size of my video because I want you to see each and every value of this table properly. So now I hope you are able to see everything that is available in this table. So I'm giving you a couple of minutes so that you can go through with this table. So it is important to understand. So if C is your first programming language then it is very much important for you to understand what data type is. Right. So basically data type is used to declare variables. If you want to create a variable so we use data types. So if I take you to the example which we implemented yesterday. So here you can see we have a statement where we are creating basic salary DAHRA and GS. So these four are variables and this float is a data type. Right. So whenever you create a variable and in variable we can store some constant values. So for that purpose for variable creation purpose you just need to declare a data type as well. And you need to know what all data types available in C programming. Right. So with the help of this table you will be able to understand the data types. And in C programming we have two types of data type one is primitive primitive or primary and the second one is secondary or user defined. Right. So if you talk about other programming languages like Java, Apex. So there also we have two categories. One is primitive and one is user defined. Right. So here we have a list of data types like int long and unsigned int unsigned long and care float double long double void. So all these are data types which are available and these are keywords as well. So in one of the session I discussed like in day one I discussed about keywords. So we cannot use keyword as a date like we cannot use keyword as a variable. Because keywords are reserved but all those keywords are basically used as a data type. So these keywords or you can say data type meaning is predefined. Right. So you need to use them as is and you cannot modify the meaning of these words. Then here memory space is available. So whenever you create any variable of particular type so this much of space will be allocated to particular variable basis on the data type. And then we have a range like this is the range where like you can decide what type of like with the help of this range you can decide minimum and maximum value that you can store in that particular variable. And then we have a format specify. So as we know like in C programming we need to use printf and scanf. So you need to remember as per the data type you will be using these format specifiers. Right. So basis on these format specifiers you will be able to use the printf and state scan of statements. Right. So this table you need to remember and going forward whenever we will be implementing the like solution of problems. So we'll be mostly using in float care. So these three will be using frequently because these are three different data types that we'll be using to create the variables. Right. So now oh sorry after this discussion I have one more slide. Yeah. So it is here. Let me just show you this thing again. So here we have a list of few programs. So these are some basic problems that I'm going to implement in front of you. Right. So if you're a beginner so you can also try to solve these problems with me. So we have a first problem which says like we need to convert Celsius to Fahrenheit. So basis on the formula we'll be doing this. So we'll be receiving value of Celsius from user. Then we need to apply a formula and then we need to convert that value into finite. Right. So let's jump on to this compiler and here we'll be calculating the results. So I'm going to implement the code first and then we'll check the result. So here I'm going to use float as a data type and I'm going to declare two variables. One is for C likes and Celsius and second one is for night. Right. And we need to receive value of Celsius from user. So here you can write enter value of Celsius. And then you can write scan F percent F comma and then you can write percent M percent C. So Celsius value will be stored here. Now if you don't remember the formula like how to convert Celsius into a Fahrenheit. So I took help of a blog of Baizu. So here this formula is available. So we need to convert Celsius to Fahrenheit. So this is the formula C into nine upon five plus 32. Right. So we'll be using this. So F equals to C into nine upon five plus 32. Right. So this is the formula. So basis on this calculation will be performed and the result will be available into F variable. So what you can do through print F you will be able to display the result. Okay. So this is the total calculation. So as you can see like this is only day three. So I'm just picking small, small problems so that you can try to solve them. So I'm keeping in mind like you are totally a beginner who doesn't know anything about programming. So that way I'm trying to implement the solutions and day by day difficult problems will be there. So we'll be covering C programming first, then C++ and then if you jump on to the Java, Apex or any other programming language, so you will be able to pick up the speed. Right. So this way calculation is happening. Now I just need to save the code and I'm not saving the code. Yeah, because it is online compiler. So there is no need to save. But if you want to save, I think if you press control S. So I don't think it will be saved. No, we cannot save. So what you can do if you're using online compiler. So if you want to maintain a repository, if you're a student and you want to maintain a collection. So what you can do just open notepad and in different different files, you can just copy and paste these codes. So right now I'm just clicking on run. And here I'm entering Celsius. So let's say I'm entering 70. So here you can see it is showing Farnet as 158. Right. So basis on this formula, it is giving the result. Right. And if you want to do some precedence calculation, like if you want to do multiplication first, you can put these in parenthesis. If you want to divide, so you can put this in parenthesis. Otherwise, the default precedence like order of operator execution will be preferred. And this, this is true for all other programming languages as well. So this is basically an expression. If you want to customize it, you can. So I hope with this demonstration, you are able to understand how we can convert Celsius into Farnet. Now moving to next question, which is to convert Fahrenheit into Celsius. Right. So now what we need to do, we need to create two variables, which will be same. Now here I need to and receive Fahrenheit. Right. And here I'm using F and here I will be showing Celsius and C. And I also need to modify this calculation. So if I go to this document again, so what we are trying to do, we are receiving Fahrenheit and we need to convert it into Celsius. So here we have Fahrenheit to Celsius from formula. Right. So we need to apply this formula so that we need to apply this formula so that we can do the calculation. So here you can see formula is available F minus 32 into five by nine. So we'll be using it. Right. So this is the formula. And here in this formula, you can see F minus 32 is in parenthesis. Then we have multiply and five by nine. So I'm putting it in parenthesis and multiplication five by nine. Now focus on this. So yesterday also we did the same calculation like we divided two integers and we received value as zero. So before modifying this, I'm going to run it before modifying this. I'm going to run it so that I can show you the result will be zero. Right. Because five upon nine will be zero. So if I run it and if I provide some input here. So here you can see it is one point one one. So basically what is happening due to float data type, it is converting into float value like first of all this parenthesis will resolve and then calculations will be done. But if you want to do it more properly. So what you can do along with these two five and nine, you can just convert one value into a decimal point value. Right. So that it will work properly. So it is part of best practice like in two values. If you apply division and first value is less and second like numerator is less as compared to denominator. So in that case, you can apply five point zero or something like that because it is considered as integer. Right. So this way, guys, I hope you are able to understand how we can implement the logic in C programming. Yep. Next is calculate area of triangle. So now we have an article on area of triangle. And here you can see we have a formula like one upon two. Then parenthesis B into H. Right. So base and height. So this is one type and another one is like through this. This heroines formula if we apply. So this also calculates area of triangle. Right. So let's implement the first way. This one A equals to one upon two and then B into H. So this formula I'm going to implement here. So what we need to do, we need to receive B and H. And then we need to calculate area. So I'm using these three variables. Then we need to receive two values. One is base and one is height. So here two times we need to use percent F. So first we'll be receiving base and then we'll be receiving height. And then we need to apply the formula. So formula will be one by two. So here again, keep it one point zero upon two and then multiplication, then parenthesis and inside parenthesis, we need to write B into H. Right. So as a beginner, you need to focus here also. I used multiplication sign, but if you see the formula in mathematical form. So after one by two, we don't have any multiplication sign. So in mathematics, if you have any value before this parenthesis, so we consider like there is a multiplication sign in build, but in programming, nothing is in built. You just need to specify if you want to perform any operation. That's why this multiplication operator is important here. Right. So this way now calculations will be done and here we need to display area. So area is basically stored in a variable. So that's why here it is written like that. Now I'm going to click on run. So I will be entering B and H. So let's say four and six. So this way area is calculated as 12. Okay. So half of B into H is basically area of triangle. So this is first formula that I implemented and I hope you are able to understand. Yeah. So savior is saying area equals to base into height upon two. Yeah. It will also work. Both are same. Okay. So you can write it in a different way as well. Now I'm going to show you how you can implement here on formula. So here we have this hero's formula. So first what we need to do we just need to calculate this entity a plus B plus C upon two. So we need to calculate S and it is I think it is known as semi parameter of triangle. So with the help of S we'll be applying this formula and then result will be calculated. Now you might be wondering how we'll be using this square root. So this button is not available on keyboard but we can use a predefined function SQRT to calculate this. Right. So this is important to know. Now I'm going to implement the solution for this. So here we'll be implementing three variable ABC and then fourth one is area and fifth one is S. So we are going to read three sites ABC. So three sites values will be available into a B and C variable. So here percent F percent F percent F will be three times. Then we need to have a B and then C. Right. So this way three variables we have and three different values will be available into a B and C. Right. Now we need to apply some calculation. So here I'm writing S equals to a plus B plus C. Let me just check the formula. So divided by two. So here I'm writing divided by two. So this way S will be calculated. Now we need to have the area. So for that we need to have one function that is SQRT and inside this function you can implement this S into S minus A into S minus B into S minus C. So S into S minus A into S minus B into S minus C. So this way I'm implementing it and here I need to include one header file. So that header file will be math dot H. Right. So if you are using SQRT function. So you need to use that header file. And this time area is available into area variable. So this is the calculation that I implemented. Now I'm just clicking on run. And here it is asking for three sides. So I entered four, five and six. And here you can see area is calculated as 9.921567. Right. So this way if you want to perform square root of some value. So you can put it. And in most of the programming languages we have predefined functions. So here like this is the third predefined function we are using here. Prior we used printf scanf. And now we are using SQRT and SQRT is defined in different header files. So that's why we need to include it in our program. Right. So this way I hope you have understood how I implemented this solution in front of you. So I am explaining each and every program in detail. So my focus is on the beginners. So those who are like entering in BTEC and want to understand C programming step by step. So this bootcamp is for you. And if you are from non-technical background and you don't have any exposure to coding and you are from non-CS background. So basically this bootcamp is for you. So I will be explaining each and everything in detail and you can see we have like I am doing this third session and I'm explaining each and everything, writing each and every program in front of you. So if you are a beginner, so what you can do, you can just implement these solutions at your own if you want to become a good programmer. So don't think these are very easy quotes. Right. These are easy because you have understood the whole explanation step by step. Right. So now what you need to do. You just need to implement these without taking any help in your system. If you implement these quotes in your system without taking any help after watching these videos. So it means you are getting enough knowledge around coding. Okay. So do regular practice. This is the only thing you can do if you want to improve your coding skills. So now we have one more thing that is area of square. So we need to calculate area of square as well. So from online audience, can anyone tell me what is the formula for calculating area of square? Anyone from live audience? If you tell me like what is the formula for area of square? So it would be good. So I'm just modifying this code so I can see I have one answer which is a cube. So Mahima responded a cube. Anyone else just check. So you can open Google. You can search the answer and you can share the answer with me because I want you to do some research as well. So if you can show me the formula. So those who are connected live, if you can do some research, otherwise I just need to search for area of square. So it is basically a square not a cube. Right. So I'm going to implement it for you. So basically we need to write a area equals to a into a right. And we have one more way to solve it. So we can write a sorry, we can write area equals to P or W a comma two. So P or W is basically a predefined function. It is also defined in math dot H and here first we are passing base and then we are passing power. So this way also you can calculate area of square. Right. So if I execute this code, so you will be able to see the answer. So I entered five. So it is showing me the result as 25. Right. So this way, if you implement these programs in your system with the help of online compiler or if you have any compiler installed in your system, so you can use anyone and just just practice everything, whatever I have demonstrated. So today's session is a little bit short because I was having these things to explain to you. If you go to the session tracker, so next week, next week, we will be having three more sessions and I will be rearranging this because this one is covered today only and a few examples we covered like for me to centigrade centigrade to Fahrenheit and simple interest and perimeter. So I will be redefining this session tracker on weekly basis so that whatever topics we are covering that I'm writing above along with the session link and then below you will see the modified things. Right. So right now, three sessions are done and lots of examples I demonstrated. So if you are a beginner and you want to do proper practice, so I think this complete session tracker will help you to understand code in a well way. So after C and C++, if you try to understand Java or Apex programming, so it will be very easy for you. Okay, so this is it for today and if you have any doubt, you can ask now and please share a review or feedback and share this channel with lots of folks because I can see lots of folks are joining live and after this live session, lots of folks are watching the recordings as well. So please share the session link with folks so that they can also understand the basics of coding with the help of C and C++ programming. So with this note, I take your leave and next week I will be sharing a few more topics with you related to C programming. Thank you so much. See you on Monday. Same time. Thank you. Bye.