Fundamentals of the C Programming Language | Nikos Katsilidis | Skillshare

Fundamentals of the C Programming Language

Nikos Katsilidis, Computer Science Courses | 10K+ students

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
42 Lessons (3h 56m)
    • 1. Promo Video

    • 2. Lecture 1 Introduction

    • 3. Lecture 2 Installing Xcode

    • 4. Lecture 3 Install CodeBlocks

    • 5. Lecture 4 History of C

    • 6. Lecture 5 Hello World

    • 7. Lecture 6 Basic syntax of c

    • 8. Lecture 7 Basic syntax of c part 2

    • 9. Lecture 8 Basic syntax of c part 3

    • 10. Lecture 9 Decision making part 1

    • 11. Lecture 10 Decision making part 2

    • 12. Lecture 11 Decision making part 3

    • 13. Lecture 12 Decision making part 4

    • 14. Lecture 13 For loop in C

    • 15. Lecture 14 srand & while loop

    • 16. Lecture 15 For & Do While loop

    • 17. Lecture 16 Nested for loops

    • 18. Lecture 17 Arrays

    • 19. Lecture 18 2D Arrays

    • 20. Lecture 19 Array of characters

    • 21. Lecture 20 Functions strcpy,strcat,itoa & puts

    • 22. Lecture 21 Text array

    • 23. Lecture 22 Introduction to functions

    • 24. Lecture 23 Void functions

    • 25. Lecture 24 2D array in function

    • 26. Lecture 25 Variable scope in functions

    • 27. Lecture 26 Introduction to pointers

    • 28. Lecture 27 A simple example of pointers

    • 29. Lecture 28 Pointer to an array

    • 30. Lecture 29 Pointer to an array, a simple example

    • 31. Lecture 30 Initialise an array with the use of pointers

    • 32. Lecture 31 addWords function

    • 33. Lecture 32 - Passing by value, passing by reference

    • 34. Lecture 33 Returning two values, using the pass by reference method

    • 35. Lecture 34 malloc function

    • 36. Lecture 35 Array of pointers

    • 37. Lecture 36 Your first structure

    • 38. Lecture 37 Typedef in C

    • 39. Lecture 38 Accessing structures by using pointers

    • 40. Lecture 39 Structures and functions

    • 41. Lecture 40 Read a file

    • 42. Lecture 41 Write in a file

15 students are watching this class

About This Class

Who is this course for?

This C programming course is for beginners who are not familiar with the C syntax. It takes you step by step with easy and simple to understand lectures from not having a clue about programming to creating your first command line application within minutes.

What's different about this course?

It doesn't contain complex code that is difficult to understand by the average Joe, unlike other courses that do that. All of the lectures in this course are based on C principles simplified enough to understand them. Plus, this course provides extra 28 exercises for further practice. To take this course you don't need to be a genius or a computer expert. You only need to know how to use a computer and have passion about learning. 

About the course.

  1. This course explains how to create a basic C program.
  2. Explains almost every aspect of the C programming language. 
  3. You will be able to create your first command line application within minutes.
  4. C is the first programming language to learn and the mother of all programming languages. 
  5. You will only need to set up an IDE, which we explain how in the first section of this course.
  6. The source code of all C programs used in this course are included in a downloadable .pdf form.
  7. This course provides complementary exercises to practice on the material of each section. 
  8. There is a total of 28 exercises for extra practice. 

#Warning! If you search for a course with a lot of unnecessary details that doesn't  help you to learn then, this is not the right for you. This course doesn't contain fancy code that is difficult to understand and write. It is an easy course for those who want to see immediate results without wasting their time and money.#


1. Promo Video : welcome to the fundamentals of the C programming language. Here you will learn all about the same language by according with examples, My name is Nicolas Hostilities. And along with my contractors, conditions to buy Ladies and George Utilities, I'll be living through the course. I am an undergraduate student at the Department of Information and Communication Systems Engineering at the University of the Aegean in summer. Also, I'm a software engineer at the Unique Productions. My contractor, Crystal Palace, is also an undergraduate student at the same department, and he is the designer of this course dirt cattle. It is a Univ. Instructor and the video producer at Unit Productions. We've designed this course for anyone who wants to learn programming, starting with the fundamentals of the C language. By the end of this course, you will be able to create any command line applications based on structured programming. We'll be getting the C language based like a damage material, and we will guide you step by step through lectures followed by exercise. The ideal sooner, for this course, is anyone who wants to learn everything about computer applications, and they could be kind software. It is also for programmers with no experiencing see that they want to expand their knowledge in other programming languages. If you are already an experienced programmer, then this course is not ideal for you. Feel free that they could look at the core description and we look forward to see inside. 2. Lecture 1 Introduction : welcome to the fundamentals of the C programming language. Here you will learn all about the same language by coding like a pro. This lecture is an introduction to the course here. I will explain you the structure of the course. We created the course with the entire academic material off structure programming presented with simple examples. With this course, you will understand the C language easily and you will make a very good introduction to programming. Initially, you will see the installation of the basic modus operandi off both coding environments such as called blocks index cold. In this course we explain the lessons with export. We will start with the basics index of, say, by printing messages and 1000 comments in the correct way. Then we will explain the variables and their types the control statements, all the looping iteration methods. We also explain a racing details and how to edit them. We cover functions, pointer structures and finally they input output files. This is the academic material of most universities which will a cure with correct, easy and simple way. Finally, Section 11 will provide your exercises for each section off the presented material and section 12 will have the solutions of the exercises. These exercises are for better understanding of the issues and they help you to get familiar with the language. It would be good not only to read the exercises, but also solve them. 3. Lecture 2 Installing Xcode : in this lecture who explained how to install Lex Golden marks in order with right see or the program in other languages, you need an integrated development environment or an I D. If you give them a computer unit installed X Code to write C X Code is free of start SLX cold Goto Absar Search for the exclude application. Click at the X Good up to read the description of the program or click right here to install it once you download X gold full of instructions to install it. Great your first see program. Open X cold, then click creating New Export project. Choose command line tune and the next inside the product name. Write the name of your project. For example. Hello world, then click. Next here. Choose the file that you want to save your project toe and then click create at the left menu to the main dot C five, which is inside your Projects folder. This find is where you write your C code in. We will explain all these keywords in later electors. Thank you for watching and see you in the next lecture in which we installed God looks 4. Lecture 3 Install CodeBlocks : Hello and welcome to Lecture. Three in this lecture will explain how to install code blocks in Windows if you use Windows Unit code blocks to write C programs to download good looks, you need to open a brochure. Go to Google at the search search for code looks to go to the code looks official site. Once you go to a code blocks official side, go to downloads. Look, Donald the banner release and choose a link off the two provided for the cold Look, 16.1 set up the Exit I to source for its dot net. Once you click one of the two links or down and will start automatically follow the instructions to install code books to create a new city project. Open code books. Once the gold blocks he's open. To create a new project, click Create a new project from the Left menu, chills files, then to see simples plus source and click. Go to this in language and then click next to shave the project like the three dots and choose the file in which you want to save the project. After you've done that, type the name of your program just in our case is the hill, the world, and we save it to desktop. Then click next toe. Read your first program. This right here is the file in which you write your C code In the yellow opinion is ah, build battle with the green play is the run battle and the combination off. This too is the build and run battle. Thank you for watching this video. I hope you enjoyed it and see you in the next lecture. 5. Lecture 4 History of C: 6. Lecture 5 Hello World : hello and welcome to lecture five. In this lecture on, we're going to learn the cynics of comments, the basic libraries that we use in almost every seed program. And we will write our first hello world program. Well, I'd sing lying government, my typing to slashes. Usually right. They find that we working, which is in our case, is the main Don't see file the name of the program Lecture five Hello World and the name of the name of the programmer and the day that he created the problem created by Negros facilities Bone 14 12 16 now for a month for multi line comment with type class asterisk to open the multi line comment. Then we diaper comment. This is and multi line government and we close or, um, a little in common with the last risk, and it's last. The first thing we need to do in order to ride the See program is to include the Hitler files that we need. Hither files are part of the system. The library, which provide type definitions and functions for tasks. Such a string handling, mathematical computations, input output, memory monument management and several other you know, program we need the input and hardwood hither with is the estate deal dot It's hither. We do this by typing. Ha's include this. How we include hitters has include on the quote and inside the angry quote the name of her hither, which is a CDO dote eight and we close the angry world. No, this hither contains functions for important output, such as the primitive in this kind of functions. The second thing I wanted to do in order to write the See Program is to create the main function inside the main function. We will include the code that is going to be displayed in the consult know whether functions this index all functions like this function type, followed by name opening and closing parentheses. Inside the parentheses are the parameters off the function, opening and closing hungry quotes and at the end of her function, what it there what? They're the function type. No every statement in C history and with a semi colon. The seven colon tells the computer that here and the statement to understand that this is the end of the statement, don't forget to use semi colon because your program will never be executed? No. In our case, our men remain. Function is usually int in there. The name off a remain his standard and it is always made is the name of the function. We usually don't give my unders to remain function and waited there and ended there, which is usually the number zero No toe Bring their first message to the console. We need to type. We need to use the printer function. So we type print death, opening can closing parenthesis and semi colon to end our statement Inside the parentheses we opened double quotes and inside the double quotes with type the medicines or the string that we want the consult output. So we type Hello world and the windows the box Listen that indicates a new line to the console Let's build and run our program and see the result as we can see the console Print it Hello world That was Electoral Five Thank you for watching this video and see you in the next lecture 7. Lecture 6 Basic syntax of c : Hello and welcome. Vanessa sits. This elector will talk about viable declaration. We're going to learn this index have been there in this kind of functions instead of the most basic and useful functions in C. The last thing we will is there a medical operators how we can make operations and see. We will see how some struck wanted black and divide numbers. In order to start, we need toe declare our variables virus and being leaders, floats, characters or other things when declaring environment right, the type and then the name. In our case, we're going toe declared to indigenous driver's name. Thanks. And is it and a floating environment? Did that go name? Why? Then we're going to assign by 13 Why and side place. Let's bring the coolant for perverts. What was that? Bring this quotes 11 quotes and inside the devil coat quotes. But that person that's and the east the number that we want to bring this It's this month percent, that's yes, is the number that we want to print his float. And then after with that, we will take the name of the variables respectively. Mix what the business Let's see the result. My beautiful as you can see Thanks. This fight Why is no? If you want precision in our floating point number, we will bring two different ways. We will bring it in a different way. 5%. It's yes environment that starts floating balls number And now it was once so this month Precision. What was that? That and at the right side of the book. So no, it would be the runner program we would see in the box. Nissen We will see the console outputs 5130 which is looking for number within two this month, first per season. We were friends, your sandals from away and at the left side of the boat we got four. This means that the console will output four digits, three spaces and five. It means that we will have space for port visits at the left side of the door, including five. No case it will. It will be the one of a problem. It will print space for three digits. And after the number here, no, we will see the sin that the sin that's over the scholar function first we have to from to do that to give us. After that we will give this kind of function over debris quotes inside the parentheses percent. That's the it will waas toe Still a decimal number in environment Former the address sign and the name of the viable that Who wants to start the include of the user? The sign right here that is a computer to save them there in the others off the viable name dates? No, let's front user who give us a second with second number It is float. This is and we will use the scandal function. Who did it? This number is the number we're looking for number with the percent. That's if inside the double quotes Homa Now they're sign in the name of the violence. Finally, we're going so some x and y And at the result of information the harbour Is it that X Plus ? What? The summation? No, let's print. There is a thanks. What is Homa? Is it? Let's build another problem. G and things there. All right, you're flogging on number number. The some X is 8. Lecture 7 Basic syntax of c part 2: Hello and welcome to Legend seven. This lecture. We're going to learn about the brain element and the most increment of Raiders. Let's go make a possum Inside are many monsoon We're going to declare toe instead. Environments Person J no, we need a sign. Zero i What was that? Let's No, it's the value of I zero in the vanity instead, No, we will see the Pringle in operating in orderto bring clement out. They value but will like i acres last plus bless. Plus, before Z is the Pringle in or great the requirement of a hater will increment the vile offers a the increment, its value will be assigned. Why? So you read Reince again the values the console will bring. I was 11 and they papers left. Well, this no, I was here to see the posting Women Liberator What's the difference from the president of the bases? Hi Good. They last plus this plus plus after today is the most implement Overrated. But you see the difference from here Toe initialize Oh, I ends a No. The most cinnamon operator is going to increment value Z with the same Kwai prior to Langermann's. So we were green. Our values all right is going to be then and they is going to be left. Let's see that about how I stand on the violence is let him thank you for listening and see you in the next election. 9. Lecture 8 Basic syntax of c part 3 : hello and welcome to saturate. In this election, we will learn about typecasting. Let's start with a simple example of that casting. First, we have to declare toe in the variables with names X and Y ex. What and offloading name is it? No, let's assign, then let's and three who are no. Well, we have to do is a divide x over y and the sand. The result was it It goes by tapping zit girls Thanks over what you see. The result we use the been the function in this the sentence it's oh my is that let's build a problem and see the result. As we see here, the console prints that the values it is three which is wrong because 10/3 Engels toe three points. This happens because we're signed. Result off a division between two indigent numbers in a flood of iron. Correct this problem. We need casting. We will cast Thanks as long. Do this with that. Is that because we opened fire? This is thanks or other site or other types of valuables that you want to. All right. Still, in our days we want to convert our ended. There is low. And let's think again. Oh, is it? See that there's a big hole filled them as we're going to see here that his own now is correct. Because we used casting. We converted ex committed to flooding. Casting is used in dynamic memory location and this really important to understand how it works. Thank you for listening and see you next section. 10. Lecture 9 Decision making part 1 : Hello and welcome to six and three lead tonight. In this section, we will learn about decision making statements the six and is divided in four parts. Your first thought. This is the statement. We use the statement when we want to make it. Susan. And when we want are called to be executed based on that decision in order to understand each didn't we're going to study more calling this season making problems. We had a bookstore that sells books for $15. It's the owner of the book. Stone wants to make 10% this time For every customer that advice more than 50 votes? No, that to solve the problem, you go inside the main constant. First we will number was this song will be blessed afloat Price to store the price off the books after this time. No, we're going to give us number. The bulls that wants to buy so but give the lumber is like we just Let's go this function toe Get them come because it percent That's the Homa. The name Well, the Bible. I want to start. Well, something user. No. We're going to use the if statement you control. No one, right? They've statement. Check if the books that the testament boat are more than 15 Sophie, get this time. This statement is simply by writing open fire. This is open the close of Perry brackets. No. And said the fantasies we control the statement is true. So the cold will proceed to build inside the wrecked. You know, these the most books is greater. So they owners will make a distance this past and said here just the kind of practice We will shoot this count that price No number boats. Nice guys. $15 Muns, 10% this fall fries thumbs over 100 with a price. This gun. What? Well, rice? No, let's on our program and see what happens. I think the number of moves that you want to buy, I think the number the program when ends because dozens have any called other than zero is less 15. So the cold inside the kind of brackets is not execute. That's what happens if we have a problem again. Mobil's six symbols The price after this come is 216 others. This happens because 16 is greater. Uh, and the cold inside the brackets is excluded. Thank you for listening and see you in the next election. 11. Lecture 10 Decision making part 2 : Hello and welcome to lecture Tong in this lecture who learn about the evil statement, we will extend a previous problem and we will make our code a little more complex. In order to understand the evil statement from the biggest problem, the book owner decided to make three distant packages. It is stoned for the Castleman that by more than 15 books in this town for the customers but by more than 25 books and the distance for customers that buy more than 50 books, those who buy more than 15 books will have and 10% this gun the rains for the 10%. This gun is between 15 and 25 both so inside First, if we will add Lourdes gun and this alone and compares if both statements the left right center from the blood are true. If both are true, then proceeds to the cold. If London off books bless them and five then but hold Then we're going to use. Then we're going to use and befell. Stedman ends this index and we open parentheses. Current brackets just like if stable. And where will die number books? Yes. Today they are 25 old number books has to be less. If this is true, the customer will have 20% of this time. Nice Staples Number Books times 15 Which is the price off arable miles? A price. Well, volts buys that 20 over 100 to, and that's the price After this girl, Wait. Well, the price after this girl is presented a low price looks the prize with 15%. This stone will be to control well and soon. Statement. Inside the but number books is off 50 the open brackets, and if a customer buys more than 50 books, he will have a 30% discount. So let's face the cool from the big else, but it's that will be 30%. Let's Ah, one more Paul's statement. Old being there, that you you don't don't the Stones, because this passenger one of these phone, because give the number of books between this range will be less than 15. So he won't say that this count. Now let's building around program. Give the lumber off books that you want to buy. Remember the price after this country's 564? Let's try another option. Even I'm of books that you want to buy, you don't forward this fall. As you can see here, output depends on the they both and number. That's raids just just 100. This one. No, this is the basic structure off the decision making statements in C electing the next lectures, we will see some mother decision making statements different than if I'm stating thank you for listening to this course and see you in the next. 12. Lecture 11 Decision making part 3 : Hello and welcome to Nature 11. In this lecture, we will learn another form off the people statement. I would just call the conditional operating for this lecture. We will use the cold and the problem from the British selected before explaining the conditional operators. We have to play that. One of the statement doesn't think curly brackets all the cold of the next line is execute here. In this case, we have an if statement, we'll bring the function the next line. If the number of books is breaking records to 15 then the console prints that you have a distance. Let's on our program. Get the number of books that you want If we I think the problem will ends because there is not experts. But Way 16 console will bring you haven't discounts, okay, but it's safer to use card brackets evenly. You have only one line of code who will execute after the each statement. Now let's see the syntax of the conditional liberating. First we open and closed practices tends inside the parentheses. We thank the statement, but we want to Control is the number of books is greater or equal to 16 home that quest. Question Mark, if this is true and at the right side of the question mark, we want to executes the code. Even the statement is true. The's case. We won't compensate. The price price becomes to a llama Books. That was 0.9 is. Then we use proper lower adult, and we actually could the as our off the gold. The statement is false. These parts is wolf. Cool these cars? No, it's with this. This car is Yeah. And Naples. A viable press. That's not a problem. Give the number of moves that wants to buy 16 prices. This come is this one. Let's run a program again. Because this count in the process of this count is zero. That was lecture 11. Thank you for listening and see you in the next election. 13. Lecture 12 Decision making part 4 : Hello and the welcomed elected 12. In this lecture, we explain the Sendak's off the street statement. The scene looks off the streets. Statement starts with the keyword street, followed by parentheses and then weapon Carly brackets. Inside the car brackets were at the cases off the streets. In the different case, every gaze has a constant if the constant is a girl to the expression inside the parentheses off the streets than the cold off. This case is executed every case and with a break, get work that exit the street statement. The different case covers all the other cases that are not written in the streets. Statement. No, Let's see an example to clarify the use of the street statement. We're going to create a calculator. First we declare to inventors in X and y then a car, is it? And then we need to problem the user with a bring the function to give the twin daughters you first in Windsor mirthless and Scott Nifx percent. That's the we use them scan. If I could get the user input, we do the same thing to get the second ending there yet give second in the chair and story to variable way. No, I went from the user to give us a symbol Give plus for some or minds core. It's obstruction bucks. Listen. No, Here it will use skin if and get the character and sort to sit. What is going to happen? Because previously we prompted the user to give us doing the doors as we as the user types . And there Then there is going to be stored in this character in this, uh, viable as a character. So in next good. We need do use scan death two times in order to get the character that we want and not the enter. This is called in Ah si programming buffer overflow. Have you use gold blocks here instead of using two times kind of function before Before the scan f you need to use the f flus function nested in to clear the buffer. This works in code looks and these works in x coats for the buffer Overflow. Excuse me, Mr. D Out. A flask tested out? No, inside the parentheses we take If is it is plus or minds case. Plus, do this some case mind Do this subtraction so back. Bring this. This sum is percent. That's the coma X plus. Why case minus With that bring death, this obstruction is presented the X minus y different. We use a print this type errors. No. Let's build around our program and see the result. Bill succeeded. Give first thing under six. Give second in under five give plus For some. The sum is 11. The some works pretty well. Let's test this obstruction. Also give her still under six. Give civilians or five give minds for obstruction. This obstruction is one. Our program works pretty well. Thank you for watching this video and see you in the next lecture. 14. Lecture 13 For loop in C : hello and welcome to lecture 13 section for in this letter we talk about the full open sea , the for loop. It's used for duration when we want to use the same code over and over again. Interesting methods are the perfect tool for that job. In this example, we need to calculate the Siri's s ankles 1/2, plus 1/4 plus 1/8 bless 1/2 to the power offend. First we need toe include the must dictate either which is used for calculation off the power. No, let's declare doing the jurors and I coma and and afloat some. No, that's from the user with a bring the function. Give us a number of the terms that he wants. Calculate. Print this, give in number off there's box. Listen, we use this kind of function to get the input percent. It's de coma and no, let's sit some 20 instead of funding and times 1/2 to the power Affin, we use the for loop that does it for us. The syntax of the for loop starts with a four key word, followed by parentheses, and then we open carl brackets but inside the parentheses, we have three parts of cold. My starting point, the starting point of the look, the ending point off the look and the step off the duration with two Norgay's. Our starting point is zero. Our endpoint is and and our step is one. So we type I plus plus Fry Eagle's zero I lesson, then I plus. Plus, these are the three steps that with type inside the part of this is off the for loop. No. Instead, the Kyle brackets off the for loop were at the court that we want to be executed several times. So we type some because we want to calculate the sum of this Siri's ankles. Some bless one over two to the power. If I This function is included in the month that age function and calculates the power off to to the power off, I outside are for loop. We type the some this Sammy's percent that the bucks listen coma some percent. It f cumbersome because some is afloat viable. Let's build a runner program and see the result Give the number of terms to the sum is 1.5 . Let's build a rather program again give the number of terms. Three. The sum is one of 1 75 Our program works correctly. That was a lecturer. 13. Thank you for watching this video. See you in the next lecture. 15. Lecture 14 srand & while loop : hello and welcome to lecture for 10. In this lecture we explain the Essen function and the wild look, which is another interational method. We use the why. Look, when we don't know the accurate number off the rations in this lecture would create a program that generates random numbers until the number zero is generated. Now, for solving this problem, we need to include the S video rotate hither, which is for input and output, and to two more hitters, which are the S. D. The lived rotates hither and the time the date either, but contain the S run function. It's, um, function is it? Shoot around the number generator, which is initialized using the argument past acid for every different scene value used in a call to restaurant. The pseudo random number generator can be expected to generate a different succession in the subsequent call to runt so differently nationalisations with the same seed will generate the same succession of results in subsequent calls to run in order to generate random like numbers, Estrin is initialized to the value returned by function time. So we type time that takes not as parameter in court blocks. This works fine, but X code needs a casting toe unsigned off the time function. No, let's declare the end of their valuables that we need in our program. So we type into number counter, I mean, and the monks, Then we need to initialize they providing number with the random numbers from zero to 100. And we do this by Todd Pink around more than 101 that in these generates on the numbers from 0 to 100. If you want to generate random numbers from one 2 50 we type rand more than 50 blast one and around the numbers from 1 to 50 are generated the syntax of the while. Loop starts with a K worth while followed by parentheses and then opening and closing curly brackets. Inside the parentheses we use a statement, and when this statement is true, the code inside the Carl black brackets is repeated. In our case, we want going to be repeated until number is different than zero. We have toe initialize our violence counter to zero mean one hundreds and marks 20 Then inside that why look, we increment the counter that counts the number of iterations we DYP bring the function that tells us the federation it's a racial. The race in one, for example, and number percent. That's the mirthless end coma type, counter and number, the names, the names of the viable. Now we need to find the minimum and the maximum number from the random numbers generated if number is greater landmarks. A sign marks assigned to marks the viable number if number if number is less with an mean assigned to mean the number, then at the end of her while loop, we need to create a new random number from 0 to 100. And finally, let's bring the results the racial percent as a But listen the racial marks to bring the mark small number and mean. You know what type means to print the minimum number, and we type counter marks and me. Let's building around our program and see the result we have on 123 durations. The maximum number is 100 the minimum number is two. That was a lecture 14. We explain the s around and the cynics off while look with this example and in the next lecture we will sink a combination off the Four and Wild Lopes. Thank you for working. Lecture 14 and see you in the next one. 16. Lecture 15 For & Do While loop : hello and welcome to Lecter. 15. In this lecture, who explained that the world's index by using the code from the previous program we changed a little bit a little bit our code, my ending there a while? Nope. And changing the four look no in orderto right. But the way I look, we have to take this from here. So no way Look is used when we know that our code needs to be executed at least one time that no one lope is indexed by the doe key work followed by Carl brackets Inside the curly brackets, we write the code that needs to be executed at least one time after the closing Carl bracket. We type while thank you for the wild and inside the parentheses. The statement that controls our look which note our case. It's well number is different than zero. No norther. There are codes. The work We need to take this random from here and then it added right here. So will go the same think with the previous gold. But instead of But we use a the well look, we also I have to add four look from i actuals and I until I is greater or equal to zero and I'm with I minus minders and inside are for lube with type. There's some of the previous Siri's which some Maykel some plus one over go to coma I. Then okay, let's declare float some here 00 and even declare our And we also need to from the user give us and said and and we use gun if to get the user input called. So it's in in the jury. Okay, so I ankles for I in time. We need to declare I also okay and then we print the result off this son. The sum is person. That's f coma some No, let's building around our program. You see the result. You can see there on the numbers we have 200 durations lets it into. The sum is one born 75 which is correct. No, thank you for watching this video. In the next lecture, we will see the use off the nested for loops 17. Lecture 16 Nested for loops : Hello can welcome to lecture 16. In this lecture, we explain the next four loops. We also create a program that uses nested for loops to bring the square faster risks. First we declare to endangers. I end the day. Then we type our first loop for from my zero to three with Step one inside the 1st 4 we type the second for look ridicule. Zero is a listen three J plus plus from 0 to 3 with Step one, and here we need toe make some controls toe. Bring the asterisks to see where to bring the asterisks. We need the first line hip asterisk as the risks. The second line to hear an asterisk at the first column in the North. Risk at the Last column and the last line toe Also be full off. Asterisks do that. First we bring. That's the risk. Then we make our control to see if we are at the second line. If I was one here, we need to explain that the 1st 4 loop is ah for the lines represents the lines. The eye here represents the lines and the day represents the Collins. If I and yours one means that were at the second line because I started from zero and zero is the first line is the index of the first line and my ankles. One is the index of the second line. So if I equals one, we print inbox less end to change the line and last the risk and two spaces. This is the body of the square that would bring it here. No, we need We also need toe control. If we're at the last line off her square, if I equals to and day thank you ALS zero. This means that were at the last line off the square. So we print inbox, lis and and two asterisks and outside are loops. We create a new line. Let's build around our program and see the result. As we can see here, we have a square off faster risks. Where we do this lesson, we we do this lesson because we're going toe need less it for look in later sections and especially in the race, because in order toe add elements in an array or to bring them in the two D array, we need nested for loops. Thank you for watching this video and see you in the next lecture. 18. Lecture 17 Arrays : hello and the welcome to lecture 17. In this lecture, we explain how raise work are a skin store elements of the same type. Instead of declaring, then individual variables of the same type, we declare an array that stores 10 elements. The element of the array are accessed by an index and are a consists off continuous memory locations. That storied element, for example, an array of finishers is like this on memory. 123 coma. And as we said before, the elements off the array are accessed by indexes. The number in Gulf indexes starts from zero, so the index that corresponds to the first element is the next zero. The number that corresponds to the second element is Number one index, with a number one the third to etcetera or the way to the last element. With the index it corresponds to the last element is n minus one. Okay, no, let's go meant out. Let's come on down this explanation and let's create a program we need to create the program that clarifies the years off race. This program needs to store in an array the grades off a student in five different lessons and then to check how many lessons have great, greater or equal to five and how many lessons have grade Lesson five. First, we use there define keyword to define the name size with the value. Five. Every time we use the name size in our program is equal to five. So if we want to change it to another value with simple attends five from up here, toe eight, for example, and, um, Santis everywhere in our program, it would change it right here at the top. Okay, No, let's declare any other viable I toe store lane next of the area. And let's declare our are a. The syntax of the array is the type which defines what I provide or a viable are stored in their A. In our case, we need intruders, so we type int the name of their A with our case is a and the brackets Inuits. We diaper their size off the array. We also need toe declare to counter for a program one for the lessons that there let him grade greater than five and one for the lessons that have grade less than find now, in order to get the user input and store it in our array. We use a for loop. So let's type for that starts from zero all the way to the last element of hurry, which is I lived in size with Step one inside of our four Look, we needs to prompt the user to sit great, said grade Off a off the first lesson. Let's let them box Lis. And for a new line coma, I and we need to give this kind of function to get the user input by tapping percent that day. Because we need inventors coma address the name off our A and is inside the brackets. With that, we type the index off very so the first element will take the first thing. But of the user, the second will take the second Ah, in one of the user etcetera toe access the elements of their A. We also use a for loop. So let's type for for I ankle zero. I let less than sighs. I bless Plus, Now inside this for loop, we need to control with lessons have a great greater than five. So we use a knife statement and we type if a I if the first element. Here's great Greater Eagle to five, then increment the calendar. This calendar ends in agreement, the other counter for the lessons that have grade less than five. No, in order to print the results with type lessons with grade greater or thank you to five, uh, percent, that's the we use a box Listen for in your line coma A. I no coma and we gonna pay, which is the counter political base that lessons with grade less than five are, and we type of the name off a rather counter. Now let's building a runner program and see. The result said grade off a zero five if they want to. Six. Cool eight lessons with great, greater or equal to five or three and lessons with great lesson five are, too. Our program work works correctly. That was Lecture 17 in which we explain the Sendak's off a race. We explained how we can initialize them and how to have access in their elements in order to process them. I think you for watching this video and see you in the next lecture 19. Lecture 18 2D Arrays : hello and welcome to elect a rating in this election, we explain the Sendak's off the two dimensional race and how they work. The two dimensional array is the simplest form off the multi dimensional array. It two dimensional Ari is a list off one dimensional race. The cynics off the two dimensional array is the DYP. The name the size of rose in the size of columns who were DYP can be a valid sit type and name can be a valid see identify. No, you can imagine a two dimensional array us a table with rose and columns. For example, a two dimensional array named A with two rows and two columns looks like this. Two columns and two girls in a row. 00 We have the Indians air one in a row. 01 We have ended their two in a row. 10 We have another three, and then row 11 we have in the for the index at the first bracket. It's the index of their own appendix. At the second bracket, it's the index off the column. No, Let's create a program that stores grades off three different students in five different lessons. To do that, we need a two dimensional array. So we type didn't a three for a number of students and five for the number off lessons. Okay, we also need to declare two in the other variables for the indexes well for a high. And they and we also need to create to raise one off size three, and we need to analyze it to zero. This air A will store the number of lessons that keep grade greater or equal to five, and the other one will start the great of the lessons that have great lesson. Five. Okay, when we want toe initialize it two dimensional array we used to four loops. The 1st 4 loop in the second is nested inside. The 1st 1 the 1st 4 loop Iran's they Rose with in our gaze are the students for my ankle. Zero I less than three. I bless plus, and the second runs the column. So we're at Zagel. Zero is a Leslie in five is a blessed plus. You know it's our case. The columns off our two dimensional array off or before table are the lessons inside the nest it for Look, we prompt the user with print the function that to to give the grade off its lesson. For example, we type percent That's the first student give the grade. Oh, the percent. It's day lesson, bucks. Let's send for new line and coma. I lost one. They last won first, you didn't give the great of the first lesson and so on for its look, These, uh, these senators will change. We also need to use this kind of function to get to initialize are two dimensional array with they introduced the great that it's student gay. We do this by typing scan F percent. That's D coma address A I j. Okay, no, to access the element and ah, I see. Well, we tell a mints you have grade greater than five for less than five. We do the same thing. We use two for loops, But this time inside our nested loop, we make some controls with the FL statement. So we right if a well, I is a is greater or regular to five increment. The first are a wood stores. They corresponded, lessons ends, increment, the other very no. Finally, to bring the number of lessons we use a full look because the number off lessons are stored in these 21 dimensional race. So we type for I equals zero I less than three because this race him Blink three with Step one, bring this Z percent. That's the still dent bust percent. That's the lessons bucks, limbs and coma Type I glass one and the name over first Array and for the arrest lessons we print we use bring the function in student failed centers, deep lessons and the we use the name off the second I No. Let's building around our program and see the result. First student. Give the grade of the first lesson. Five. Let insert five in every lesson for every student student. One past five lessons to one filled, zero lessons. Student to the same suit and three the same. Thank you for watching this video and see you in the next lecture. 20. Lecture 19 Array of characters : Hello and welcome to lecture 19. In this lecture, we explain their race of characters. We create a program that stores history in an array and princess ring to the console backwards. To do this, we need to insert this drink in the secondary backwards and then print the second andre. First, let's declare an array of characters that is initialize with this drink Hill the world. We do this by typing car the name of this drink. We open bracket empty brackets and take you all with double quote that are string Hello world When we type yellow world inside the quote the car A occupies as many positions after the characters inside the quote plus one position for the bucks Less zero or null character within the kids The end off our A for example, if we create a cabaret move, then elements we can insert no more than nine character street. Okay, because it will be like this. Hi. Hi, de we Oh, uh the e and the bucks less zero character. So we have 123456789 and 10 elements. This is an array movies. Lengthen car A Nichols. Hi George is an array with 10 elements, and it's like this. So in order to store the characters off our A backwards, we need another A When and a car B R A. With length. 12 Because here we have 123456789 10 11 characters plus the backlog zero character. So we need 12 characters to store our A. Then let's declare to in the years that will start indexes of our race I and day No, to bring the first drink we use and for look, just like we print the elements off the race for from zero to the length. Who is there? A. With step one. Bring death percent that see coma A. If I This is one way to bring this drink or we can simply type bring death There's in That s coma The in the name off the array off the calorie. Okay, no dot the string in another array, but in reverse order, we also need a for loop that runs the length of the array and inserts the last character off the string in the first position off the secondary. So we type for vehicle zero j is on 12. They plus plus B of a day the first position, the first inserts toe, the first position busy off the secondary, the first the last element of the 1st 3 and then bring the array character by character. So bring that percent. That's see coma be today. Let's bring the new line here and that was it. Very simple. So let's build a runner program and see the result as we can see the console. Bring it. Hello work. Heal the world and Hill world backwards. Let's had a new line here, Toe seed clearly and let's build a runner program. So here we can see that our program works pretty well and the console output it Hello world from the first output with a for loop A hello world with the second print print with ah presented s which prints the whole string off an array. And then we inserted this drink backwards in into another area and we bring it this secondary. So Hyla World was printed backwards. Thank you for watching this video and see you in the next lecture. 21. Lecture 20 Functions strcpy,strcat,itoa & puts : hello and welcome to lecture 20. In this lecture we explain some functions that are used for processing strings in C programming. The functions of to explain are the str citywide function which cope is a string the S E R cat function that can coordinates two strings the I to a function that converts an integer to string and assigns this in the dryer into and are a And finally they put this function that princess string to the console. In order to use these functions, we needed to include two hitters. So let's type house include string rotates hither and house include yes, in the lib No dates together 1st 1st let's declare And in the dirt e in a a con today. Yes, with size 15 Terry with size 15 and the You are A with size 15. Let's initialize s with the string ABC. It doesn't matter that we initialized the S with ABC with three characters because the initial length automatically decreases to the new one. No, it would try to add the 1st 2 characters off. Yes, are a. The two strings won't become coordinated, but their values are going to be at it When I say the values, I mean of the values that they have on asking table. Ask your table. Corresponds every character or symbol with an integer. For example, the upper case say I killed 66 the upper case be killed 67. So the result off restaurant classes to will be 133. Let's print E to see the result. Let's turn our program the console prints 133. The first function not to explain in this lecture is the eye Dre function with this in looks like this Trey, and it takes three parameters the value. But we want to convert to a string the array name in which we will start the string and the basin, which we convert our value. And then we bring the string off the array. That is, um, will distort in tow. So here we want to covert on 100 33 with type e. We store it to you, Tory, you I want to convert it in a nessman strength in this model number. No, this function works perfectly fine in court looks, but the next coat it doesn't work. Shown going to comment it out, you know, instead, off typing, then weaken type also to or 16 for binary conversion or hicks A decimal conversion. Now the next function is the str super Wife function The cynics of this function he's I seriously But why? And inside the parentheses the first bottom it there is the destination of a and the second parameter is the string Toby corporate the sorcery with the destination Really? The content is going to be Corbett. So here, if we could be to us if we called me to you The condom off s and print is your the string that's inside you. We will see that these ABC as we can see I'm sorry you, as we can see the are EU is also the string ABC The next function is the str cut function with concurrent in eights two strings So it takes us parameters Two strings Yes you are str one and str toe So if we can get in it s and is you The drinks will become coordinated So the result is going to be ABC ABC The last function that we explain is they put this function. This function takes one, but I'm it there. And this parameter is the name off the caray that we won't to print to the control with. Put this function all the characters off the car A will be displayed in the console. Let's try this. Let's try to display the characters of the SRE. Yes, right now is concurred in ated with you. So the result will be ABC, NBC. Let's build around our program to seat as we can see console output. Did ABC, ABC That was a lecturer. 20. Thank you for watching this video and see you in the next lecture. 22. Lecture 21 Text array : hello and welcome to lecture 21. In this lecture, we explained how to create a program to bring the his, um, his program of frequency of characters. First, we have to include the string that dates hither. So let's type house include string the date. Also, we have to declare Gone array named A that stores 200 elements and this array will store the text from the user. We also need to declare some in the other variables and I coma and number of punked coma number. Both did it and the number of cars also we'll declare and w provided you to store the length off the text. No, let's initialize number of pounds, the number of digits and the number of cars 20 And let's from the user to write the text. Tak, bring this inside the double quote type, right, a text, that box. Listen, here we use the get this function to get the text from the user and started to the air A So we type Get this and the name of our array here we can use this kind of function because can f gets the input until it finds the first white space character, which can be either a space or and enter. We get this function can read the whole line of text, including the spaces, so we usually get this function. Now we need to find the length of their A in store it toe the Lenoir variable. We do this with the str Len function that takes us a parameter the name of Far Away. No, we use a for loop that runs the length of the array from my zero I. There's the length I plus plus inside the curly brackets inside the body off for Luke. We You have to make some controls to find the frequency off the pants off the digits and the characters. So we type the first thief to find the number of punks we use. There is bunked function. If he's bunked, you're fine. Increment the number of months and see if and if I is greater or ankle 20 and and if I it's less or taken to nine increment the number of digits and did it bless? Bless else if to find if is a character, if they re contains characters we used. The is Al from function that takes us parameter the element off the area else. If his Alfa increment the number of cars no, outside the four loop, we have to bring the frequency off the hissed a gram to the console. So we type. Bring this with a number off bunks, their ascendance, the box Lewis and and the counter for the number of monks. This and punks. And we also green to the number off. Did it in the name of the variable that we start. That's number and lumber off. God, there's and cars. Let's build a runner program. But either fixed ABC Spacey's numbers kind of theirs symbols center. No, our program works pretty well us. It found the number off bunks with seven. The number of did. It is eight, and the number of characters is 13. That was the end of Electric Tinto one in Section five, in which we started their race in C programming. Thank you for watching this video and see you in the next section. 23. Lecture 22 Introduction to functions : hello and welcome to six and six. In this section, we explain the use of functions when we have a complex problem weaken divided into smaller parts with the use of functions in order to simplify it, Its function performs a specific task at In this way, it is easier for the programmer to debug the code. Now let's see how we declare a function. Its function is a type and name and parameters inside the boat emphasis. We declare the type of the parameter. For example, if we want toe creating in their function with type in the name of the function God that they excess parameters. Doing that, there's this is the declaration. Now we want to call the function inside our remain. We have to give us parameters doing wonders. Usually under main, we define our function. A function definition provides the body for a function and it is as follows return type the name of the function Inside the bio theses, we write the parameters and inside the Carly brackets we type are statement inside the body for the function and finally we return the type off the function. No return type is the data type off the value the function returns function. Name is the name of the function, but I meant there's here when we call the function. We passed the values a parameter. The function body is defined right here and good and contains fecal collection off statements that defined what the function does. Now let's define our add function and odd, which is the name of the function that takes us parameters and in the D A. And then in the chair be and inside the body of the function we did then the some off A and B to call the function we have to pass through in the doors as parameters in order to get the some of them. So inside our main function, we declare to Inventors X with physical to three. And why? Which is a girl 28? Then we bring this the results to the console. So we type this. Some is backless and coma, and we call the function for X and why we need the percent of the because this function is there's an in the air. So let's build a runner program and see the result. The sum is 11 as we can see, our function works correctly and the result is 11. Thank you for working. Lecture 22 and see you in the next lecture. 24. Lecture 23 Void functions : welcome to lecture 23. In this lecture, you explain void functions. Would functions are functions that don't return anything. These functions are created just like all the other functions. In this program, we initialize an array with the user functions. Let's declare our function under our hither good in its allies on a which is the name of her function. And that's a barometer. We pass an array offenders no under the remain. Let's define our function. What type void in this allies are they? We open and close Carl bracket, and we don't have to return anything because the type is void. No, inside the but emphasis, we bus an array named a inside the boat of the function. We need allies there A as we've learned in previous lectures. So we learn in the dirt I. Then we use a for loop that goes from my ankles. Zero I less that than 10 because inside our main function we will declare an array with lengthen into a then for Eichel. Zero I listen. 10 high plus plus initialize are are a with zeros. We call the function inside the main with the name off our A with type in the name of the function and inside the parentheses. Oh, we type the name off the area. Actually, here we bus the reference over the position of the first element off the array. Now let's bring the area by using a for loop to see if it is initialized with zeros. For I equals zero, I let them, then I plus plus. And inside the border of the four we type percent. That's D coma. A. If I we need to declare and I and in the dry here Okay, let's build around our program and see the result. As we can see, the area is initialized with zeros. The difference between a void and int or other returning type functions Is that a void? That's task tasks like initializing an array without having to return anything. Thank you for watching this lecture. I hope you enjoyed it and see you in the next one 25. Lecture 24 2D array in function : welcome to Lecture 24 in this lecture will explain how to pass it to the array as a function barometer. First, let's declare avoid function named initialized good initialize that takes as a parameter to the array that stores in the doors int. Inside the first bracket, we tap the length off rose and inside the second bracket without the length of columns, we can initialize the length of columns and live empty the length of rose to be autumn article initialized. Inside the body of the main function, let's declare an end of there are a named A with five rows and five colon's. We also need to declare doing that. There's I and J to store the index's off our A. Then under the main, we define our function, which is avoid in these allies and inside that by embassies, eggs and are a a it to the array named a no. Inside the body over function, we initialize and to the A. As we've learned in previous lectures, we used to four loops to do that. The first loop goes from Michael zero I listen if I five hi plus plus and the second look for they a girl zero they less than five day plus plus We opened girl brackets and we initialize our to the array with zeros. Here, let's tickler the valuables. I m t okay. No, Inside the main we call our function with the name initialized Inish allies And inside the parenthesis we passed the name of very which is a pointer to the first element off our A So it would type the name A. This is a pointer to the first element off the air A Now let's bend or to the area to see if it is initialized with zeros. We do this by using two for loops for I like a zero I less than five I plus plus for they equals zero they less than five they plus plus And inside the body of the second for loop. Every time I bring death inside the double quote percent, that's d bucks less inbox. Listen Coma and Intel Ament off our A Let's use another print death here to bring the new line and let's build around our program to see the result. Bill succeeded. And as we can see, we have 1234 five five times five ankles. 25. So are a Every element of our A is initialized with zeros. Thank you for watching this video and see you in the next lecture. 26. Lecture 25 Variable scope in functions : hello in the welcomed electric 25. In this lecture would talk about the viable scope and functions. First, we need to declare Avoid function that takes two ended. There's mass parameters. So we type Floyd Fund, which is the name of the function and inside the perimeter, the parentheses with type or two in the dir parameters in a moment. Then, under the main, we define our function. We define our function by typing void, fun opening quote and this is in X for the first inventor. And why? For the second editor and we open and close Carly brackets inside the body or far function . We need Allies X with five. And why with then? Then we used to bring their function toe print. The results presented C percent. That's the Marx. Listen, coma, ex coma. Why? Okay, insider man function. We declare inlanders and x go my way. We need allies. Why, with 15 and X is a girl with why, plus five here. Why a girls 15 and ex Nigel's 20 next equals 20 And here. Why actuals 15. No, let's call our function for X and Y and let's use bring them under are cold to print X and Y and see the results X in the x Goma y No. Before we're on our program, we're here to clarify some things here. X equals five, as we can see. Okay. And why cause then? No. When we call the function fun, the console brings the eggs. And why that are defined in the body for function. X equals five and why I understand it steaks, eggs and way from the main function. But tens is why from 15 to 10 and x from 20 to 5. So this function we'll print five and then And when we call the Bryn deaf, when we type bring them inside our main function the main console, the main points of the concern the X and y that are declared inside the body off our main function. Let's building around our program to see the result. As we can see, When we called the fund next comma way, the console printed five and 10 5 and 10 and when we bring, bring the x and way the console printed 20 and 15. So this is the viable scope in functions. Thank you for watching this video and see you in the next section. 27. Lecture 26 Introduction to pointers : Hello and welcome to six and seven Electric 26 which is an introduction. The pointers, As you know every viable, is a memory location. And then remember, location has its under is defined, which can be accessed using the person operator, which the notes and understand memory. A binder is a viable whose values the address off, another viable or a direct address of the memory location at the same it. Here we see how viable looks like the Pointer stores the address off, another valuable with stores of value. With the use of a pointer, we can have access to another valuable and to process that valuable below. We see the syntax of the above image in the same language. In more detail, we declared manager with the name number. Then we declare a pointer that points to an ended, their viable in asterisk pointer inside the viable number, who said 155 and inside the pointer will store the address off the valuable number. We use the, um percent operator at the right side of the sea months. We see how is the memory that the program uses in the following program we see how we declare Pointer and how we can analyze its content. In the main function, we declare an integer viable number and a pointer that stores the address of an energy by typing int. Ask the risk. Pity are with his ankles to none. We initialize in the pointer with none. Then we said 155 toe number and the address off the viable number to our Pointer BTR Bacon's Amberson Liberator number. This is the address of the viable number, and it is start toe the PTR pointer. No, let's bring the number. Address the content of the blender from the point of address. We do this by using the printer function here. If we want dismal addresses, we use percent. That's the in the bucks. Listen for a new line coma the but they are our point. Peter stores the address off our oh for valuable number. No, that's let's bring the number that start in our Pointer was by typing percent. That's the Berks Less and coma asterisk BTR by typing asterisk. But they are you know, we have access to the continent off the pointer to the continent off the address that its start in our pointers and with another bring death. We type the ponder we bring the point of otherness percent Thursday backs Lasell Coma, um percent operator and PTR. No, if we want to bring six of them, it's a decimal addresses. We use the same bring this functions to, but instead off the with type percent the presented to be percent. Let's be percent That's being let's build a runner program and see the result will succeed it. As we can see here we have decimal. Here we have the dismal address of the number, the condom off the number, which is 155 with a second print and the address off our pointer with 1/3 with the third. Ah, bring deaf and below We have hicks. A decimal addresses the others of the number the content of the number in hex, a decimal form and the address 04 pointer. Let's thank here. PTR Idris Number of this number. There is content off going there and pointer that this We dive the same thing here to make our program a little bit more clear, Gopi. Kind enough pointer. And on the address, let's being run a program again. Well succeeded number address his nation content. Off pointer. It's 155 on the address. Is this one in decimal form? And then Hickson decimal. This is the gold right here, below this print death that use another print of here and type addresses in It takes a decimal for And But listen, I forgot to close double quotes. It's been a running program. Fundraising. He could decimal form. All right, that was an introduction. Blunders. Thank you for watching Electric 26 see you in the next lecture. 28. Lecture 27 A simple example of pointers : welcome to lecture 27. In this lecture, we see a simple example of ponders, which is not used often, but it is important to understand the use of pointers. First, we have to declare doing the others and no one coma. Number two. Then we declare three pointers. That's 0.2 engenders PTR PTR One master is computer, too. Asterisk PTR three comma. But then we need allies. We're in the divided bills Number one with, uh in the dirt. No more nickel said number two. Thank you. Understand? Within we start to are pointers to Peter to the address. No, um one. And inside Peter three, we store the address off. Numb to are second violin we also need to initialize upon. There are pointers with null. They're two eagles. No and Peter three. Nichols none is No. Let's add the content of the two pointers and store it to our third pointer. So we die. PTR one ankles, asterisk PTR too. Plus PTR past the risk PTR three. Or we can declare another in intra viable number three and store the result of these some to our new viable Peter too. Plus master risk. Peter three. No that is, let's user bring the function and see the result Number one plus number two actuals percent . That's tea, The wisdom and we use a but listen for a new line coma. 321 Let's use another. Bring deaf function. Choose another. Bring the function to bring the viable numb. Three. Uh, let's build a runner program as we can see on both. Bring their functions. Bring it to the console number one, plus Numb to Echols, 18 eight. Blessed in Thank you just 18. What happens here with big lead? Three and other viable and three pointers. We said it eight toe number on to our first viable and tend to her second viable. Then we start to our pointer, viable the address of number one into our thirds pointer, the undress off. Numb to then we use our PTR one point there to store the content off the some off for two pointers. So here we had 10 bless eight and we did the same thing here. But we store it. We start our results to a viable toe on in inter viable. And the result is here in the concern. Thank you for words. Intellectual, 27 see you in the next lecture 29. Lecture 28 Pointer to an array : welcome to lecture 28 in this lecture, who explained how to process an array with the user pointers. First we have to declare an array and to initialize it with numbers. So we type int number the name of our A brackets, then ridicules Carl brackets. And inside the car, the brackets. We himself numbers from 1 to 10 12345678 nine and 10. So we're given a with then in the doors. Then we declare a pointer that points to end in tears in Astor's eggs. Thank you, ALS none. No, we said toe X, the address off their a number here. We actually store the address off the first position off our A. No, let's see what the following bring. The functions will print. Let's let's bring X x percent. It's the apocalypse. And this, as we said greens, the address off the position of the first element cleans the address off the first position of the area. Let's see of it, X is this address. This is the address off the first position of the area. No, let's Let's bring the address off the second position off the array. But in a different way. The address off the second position of very percent. It's day bucks lists and coma, um, percent operator for the address ex brackets and inside the brackets, we type one. This is the address off the second position off the area. So these prints the address of the second position over the area. It's Bill and see the result. This is the second position off. This is the address of the second position, and we can we know it because it it is forbids later. Then our first address, our first, our first others, the others off the first position of their day ends to 56 in the second ends to 60. So we're pretty sure that this is the next undress. Very no. Let's bring the address over the first element of their A and see if it is the same with this one. So we type the first address percent. That's the bucks. Listen, coma Amberson, Operator X brackets, zero print. The other is over the first position off the array. It's been in general program. As we can see, this address is exactly the same with this one, which is theory of the first position. The address of the first position of very No. Let's bring the address of the third position of the area, but in a different way. With that, bring the if it's place to percent. That's the bucks less and coma. Next plus two, Please bring deaf right here, Prince. The third position off their A in ah, the same way with this one. This happens because thanks stores the address off. The first position of their A so explicit toe is the third position is the address of the third position of Very So The Sprint, the address over the third position. Oh, very, it's been the rental program. As we can see, his address ends to 64 which is the next address after this 1 66 4 The address is off their positions off its element off Henery. Our forbids have a difference off Forbid That's ah, how we can understand. But this is the third opposition off their a. No, let's bring the content off their A or use bring death asterisk, he others eggs percent. It's d much less then. No, let's bring the golden over the first position. With that, bring this asterisk x percent. That's the backless end. Coma asterisk x The sprint. The content off the first position Prince content off the first position. Let's see the result. Condiment off the first position is wrong. Okay, let's bring the continent off the third position by typing. Bring death a serious quickly breath. This is X plus two percent. That's D bucks less end coma here to bring the content over the third position with type asterisk we opened parent. This is Aunt inside the parentheses with Type X Plus two, because without my emphasis gas, the risk will goto x and it won't brings the the golden off the third position. No, this print the content of the the third position. Let's see the result. It's three. The content of the third position. It's three. It is correct. Now let's bring the content of the second position in a different way. We type print. If ex brackets one percent, that's D bucks less and coma ex brackets. One. This prince the continent off the second position. Let's see the result. The content of the second position is, too, which is correct. No, Let's see another use of pointers and print the content of the address off the second position implemented by one. Now let's bring the condiment off the third position by implementing the address over the second position by one. We do this. My typing. Bring this. So what type Accessories, parentheses. The address of the second position implemented by one tzekel 2% dusty bucks less and coma. Ask the risk about 10 theses Amber Celebrator for the address off the next brackets. One which is the address of the second position plus one. And now we're at the address off the third position. So this is the content off the address of the third position. Prince the content off the Andres of the third position later in our program. And see the result as we can see the console output it three. Which is the content off the third position. Off. Hurry! That was lecture 28. Thank you for watching this video and see you in the next lecture. 30. Lecture 29 Pointer to an array, a simple example : hello and welcome to lecture 29. In this lecture, we see a simple example off pointer, tannery, first place declare and in the Derry, named A with three elements with type into a bracket. Three actuals, 86 seven with three elements. The Element eight on the first position, the element. The number six of the second position and the number seven of the third position. No, let's declare a point there AP that points to in others. We do this by typing in asterisk in the name of her pointer. Now let's make this pointer to point to the first element before a no AP Angels. A point to the address of the first element of far away. We can have access tool the elements of for A by typing the name of the point there bracket and inside here we can type of index off the element. Already, AP zero zero is the index of the first element far away AP zero actual straight. So let's increment that in the years bring the function before the increment percent. That's debunks Lis end coma ap zero a zero and let's years the same print. If after the agreement to see the difference. Let's build around our program into the result. As we can see before the element was eight and Dr The Increment in Tonight. Let's use another method to print the same element percentage. Stay back. Listen, coma asterisk ap. This is so so this will also print nine. Let's see it now. You can see it printed to the console. The number nine that was electric 29 and a simple example to understand a little, a little bit better The pointers to raise. Thank you for watching this video and see you in the next lecture. 31. Lecture 30 Initialise an array with the use of pointers : hello and welcome to legs or 30 in this lecture will explain how to process in our A with the use of pointers. First, let's declare an injury named A with 10 elements and let's declare our index I no, in orderto initialize viscera with zeros, but with the use of pointers we type for from I equals zero, I listen thin. I bless plus and under for loop with type asked the risk. But any theses Okay, Plus I take ALS zero Okay. No, Well, metalized are a with Zito's asterisk where that is a bless. I accesses the content off so far a now in orderto print array. We use a for loop. I equals zero. I listened. Then I plus Blast and we die. Bring this only quote a percent. That's the Rachel's percent. The Bucks list End coma. I coma Master Risk A. Plus I this It's asterisk a plus. I ankle zero. It's the same with hey off! I actually zero to the same thing. But this is the initialization off their A by using blenders and this is the symbol initialization off their A and with this for we will bring the area. But with pointers we use as the risk a glass, the index off the position that we want to print. If you want to print the addresses or fits, the address is off the positions before a type I call zero. I listen 10 I plus plus, and we used to bring the function we open under quotes who die percent That's d backs less end v Andres off a is there's in that day coma. I coma a glass eye. This is the index. The others off the A zero, for example, is and address No, let's build around our program and see the results. As we can see, our A is initialized with zeros. But with a user pointers and the others off, its element is bring it right here. That was a lecturer. 30. Thank you for watching this video and see you in the next lecture. 32. Lecture 31 addWords function : welcome to lecture 31 In this lecture will explain how to create a function that can coordinates two strings with the use of pointers. First we declare avoid function with the name are the words that takes as parameters three raise three car race The 1st 2 days for the first world The secondary is for the second world and the third their aim is ah for the contaminated the world we needed to start the contaminated world. The main function We declare the race with names car A and we initialize them with none like this car A got to be car See every his length 50. Okay, we use the bring the function toe Ask the user from give us the first word And we used to get this function toe Get the user include and storied to their A We do the same thing for the second world Give second word and we used to get dysfunction still store They include toe the secondary. We forgot the same calling here. Okay. The difference between the get Tess Andi This kind of function is that the get dysfunction gets then put until their first The white space with, Ah, he's the enter and to this base. But you can never gets then put until the last character without the space afterwards, that that's where we use here. They get this function. No, we're going to call the other words function, which is not defined yet for the race A, B and C and we will see how we're going to find Define the function and below main. Then we use. They put this function that takes as parameter the Sierra because we want to print the c r a. The world that distort in the Serie They put this function, print all the characters inside an array inside the car A until it finds the backslash zero or the null character no below remain. We define our function. So what I'd avoid now the words we open about embassies and we pass three car Ray's got a kind of being and car see as parameters. Okay, here this function has to come the length off the world, a very a the world be, which is the baby and the length off the Concorde in ated world that's going to be stored in the racy. So we have to declare three counters. Lend one. They call zero lento like a zero and land three equals zero. His variables correspond to the length off. Its are a no. We use a four look to find the length off. Ah, the first ah, r a. So we type then one. They can zero Len one less than no. We use binders to process the a ask the risk, but an theses. And inside the bonuses, we take the name of the area the nursery plus Len one plus the length off the area. Okay. For lead. Nickel zero land less than the length off a Len. Plus. Plus this how we find the length off the r A A. We do the same thing for the length off the area being so with that for can we use the same McCollum? Because, ah, and here is we're for look ends this for Luke doesn't have body. It only increments the length. So we do the same thing for the second. All right. Led to a girl zero Len. Too less them the length off being then to bless. Bless for the length off the racy. We use another for look that girl from Len three Echo zero when three less than Len one plus lend to the length of the racy has to be less than the lengths off our A plus i b because the word saying they are going to be stored too. They're a c So we need the length off the concatenation words and we type and then three plus plus. Then we open and close Carl brackets and inside the body of the four Look, we're going Teoh. Thank you. Some control statements to take if length three is less than length one to store the characters off the air A to the r A c So we used an if statement you Flynn three Unless and then one. Then here we're going to process the array with the use of pointers. So we type has to risk wilbon parentheses C plus than three. Thank Jules, uh, as the risk and a plus Glenn three else we do with you store toe the array seem C plus Len three the characters off very big. So we taped our three squares is B plus Len three miles lend one, which is the length off the Arabian Landry minus land one when three minus blend one. Thank yours to lento the length of their A B. Okay, no, outside the body of the four look we use, we need to start the last position off their A c, the null character or the bucks less. Zero. So we die Brasseries C plus in three vehicles but zero. And finally, let's bring the lengths off the race. The length off, very a is percent. It's the Lexus and Coma Len one. We'll do the same thing for very being the length off the air. A B is percent. It's the box list and coma lend to and finally the length over there a. C he's percent. It's day bucks. Listen Coma Lynn three. No, let's building around our program. You can see the result. Give the first war like first words basket give Second World look as we can see. The program concurred in ated. The two words and branded the output also printed the length off its words the length of their A or the first word that six the length of the baby or the second world, this four in the length of their A C or the length of the contaminated world is 10 and finally them got donated. World Prince, The contaminated world Thank you for watching Electric 31 and see you in the next section. 33. Lecture 32 - Passing by value, passing by reference: Welcome to Section eight in this section, who explained how to use pointers and functions and how to use some basic memory management functions like them. I look function in this lecture who explained the passing by volume and passing by reference method also who explained the difference between them in the passing by value function we need to create a function first in Maine. We declare to in the stairs int a common be and we said one to a and 15 Toby. Finally, we use a bring this function toe print A a percent that's they be percent. That's the backless end coma A a common be no toe. Create the possible value function. We declare the function below the hitters. So we type avoid the name of the function he's possibly value that takes us parameters to into theirs. Below remain. We define the possible value function. We open and close Carla brackets and I spy Mitt. There's we declare, and in the A and anything that would be And we said a Toby here was said, I want to be vehicles one. No, let's call our possible value function in main with a on the me the function possibly value set A to be or I want to be. And then we use the printer function to bring A and B here this spring. Their function. It will not print a pickles one and vehicles one but a girl's one and vehicles 15. Because this spring the function prints the variables A and B that there declared in the main function. Weeds are a equals one and vehicles 15. This happens because in the function definition, we pass in A and B S parameters. These variables at the end off every call over the function, have dilated every time we call the function in the main new variables are created that copy the content off these variables that are declared in the main function. Also, the Cupid valuables are not linked, linked with the variables that are declared in the main function. This connection happens with the use of pointers to see the difference we declare avoid buzz by reference. Function goes by reference. This function takes two pointers that point to engenders in the US the risk and asterisk below main. We define our classified FM's function. We open close curly brackets. Here we pass as parameters into Pointer a in pointer Be and point the way that points toe and ended there. And I'm going to be that wants to another in the there. And we process their content off being a so as to be angles. Asterisk a. These sets the condom off a Toby in the main. We called the pass by reference function that takes us parameters the address off a and the address today. In this way, we connect the function with the other, sees off the incidents that we have declared in the main function with the user. Faster risks we reference toe the content over the function. This is how we access the valuables off main from a function. No, let's use and bring this below are possible value function and the print death because our below are passed by reference function. Let's build a runner program as we can see here under below the pass by value one and 15 are printed to the console and below is possible evidence one coma. What a one and B one are printed to the console. This happens because we took as parameters we passed us parameters. The address off a door function and the others will be for function. And then we processed the content off these variables. So we made be ankle 21 The continent off B is equal to the condiment off a, which is one. And after calling the function, the content will be changed to one that was electro 32. Thank you for watching this video. Kobe enjoyed it and see you in the next election. 34. Lecture 33 Returning two values, using the pass by reference method : welcome to lecture 33 in this elector who explained method to return more than a value by using avoid function. First, we declare a function below the hitter files. This function is avoid. The name is function, and we process parameters two in tears for the values that we want to send Tora function and two pointers that point to enter theirs for the village that we want to change in Maine , we declare So in other valuables X and the way and we said then two x and 15 the why we also declare doing the divi roubles. Hey, and to be to store the results. Then we call the function like this function and inside the parentheses type X call my way . We passed the values 10 and 15 tore function and the address off A and the others will be their function. No to define our function. We go below, remain and we type avoid function in X for any the viable hand wife or the other in the available and asterisk a and it in asterisk be for the pointers that's going to end it. There's no inside the body over a function we type asked the risk. A actuals X minus. Why? Why Mines X? Because why is greater than next? We subtract X from why and we said the result to the content off A which is a viable that we declared in the main function. We tends the continent off a and we said it 25 We do the same thing for bay as that. This could be angles X bless away. Here we are X and y, and the result, which is 25. We said It's to the continent off me. No, let's go to our main function and user a brain death to see the results a percent. That's name be percent. That's the bucks lists and coma. A common be Let's build a runner program and see the result. Bill succeeded as we can see a acres five and the vehicles 25. Thank you for watching this video and see you in the next lectures 35. Lecture 34 malloc function : hello and welcome to lecture 34. In this lecture we explain the memory allocation of a pointer with memory location. We create an array from a pointer. This is very useful when the programmer doesn't know the length of their A because it is defined by the user. In this programme, we need to include the S and the lib rotates together by typing has include B quote yes, the lib the dates and closing the younger quote This hither contains functions for memory location In Maine we declare a pointer that points to float float asterisk grades This pointer with the use of my look will become an array. We declare two other float float some Michael zero which will start the some of the great and float Averett which will sort of the average grade of the student. We also declared to inventors I for the index of the area and numb for the number of lessons. Then we prompt the user toe. Give the number of lessons. Anyway, here's the Bucks lesson for the new line. We use gun if to get the user input and storied toe the variable numb. This is going to be the length off there a which we will create with them. I look function to create their a With within my look We type the name of the pointer, which is great and an angle sign And now we type the syntax off my look We opened by 10 theses inside the body and this is what type the type off our pointer which is float Ask the risk Then we type am I Look when we open and close bioethicists inside the parenthesis we type number which is the viable and the length off already times and the function sighs off we open and close parentheses and the type off for pointed So we got grades ankles we open parentheses, float asterisk The function My look we open and close but and this is And inside the parentheses we type the length off our a which is start in our valuable number Bluhm times the function size off parenthesis float on this float is the type off our pointer No, We created an array with length numb from a pointer. Then we use a control statement to take if our array is empty. So we type if grades angels little read there minus one, and we use a for loop to process their A for Heikal zero i lesson number, which is the length of their A I plus plus Do Green death, huh? Give grade for less 1%. The bucks listen for New Line Coma I plus one. We'll use gun if percent. It's if the store the grade you are a grades I then we some the grades, some schedules, some bless grades where I could say outside the four look, we calculate the average grade of the student average ankles some oh, there num, which is the number of lessons. And with Brenda function, we bring the result The average grade, these percent. That's if Burtless and come evidence. Finally, we use the free function to free the memory that we allocated for our A free grades. Hear what I percent that if let's build a runner program and see the result, give the number of lessons too. Give great for lesson 15 Give grateful. Listen to five. The average grade is five. As we can see how the program works pretty well, that was then. My look function Very useful function for memory allocation. See you in the next lecture 36. Lecture 35 Array of pointers: welcome to Lecture 35 in this lecture will explain how to allocate memory in an array of pointers in its element off the array. With Great an array off different length, we will taint the code from Lecture 34 to create a program that finds the average great off different students. First, we need toe include the the Lib hitter, so we type as include nested the lib, the date which include them. I look function no in the main function to create an array of pointers with type float because we want an airy off pointers. That point to float has to risk the name off very grades, brackets and inside the brackets, the number we take the number of rows that we have. We need the already to have no this great to the array with five rows and columns a smut as the user willing boat. Now let's, um, also declare afloat some and initialize it to zero, which will store the some off the great and a viable average, which were store the average grade off its student. Let's also declare some in the doors i nd for the index is off the to dairy and a valuable number, which is going to store the number off the lessons off its student. Okay, No, let's use a for loop for I equals zero. I listen. Five I bless. Bless opening, closing curly brackets and no inside the for loop. Let's ask from the user the number of lessons bring this student. They're saying that's the give the number off lessons. Who gives a bucks less hell Coma I plus one. And we use a scandal function to get the user input and store it to the viable number. Goma. 1% operator and number? No. Inside the four. Look, we need to allocate memory for its element off the array. So we're going to need them a look function and we die. Grades, brackets. I thank you, girls, by any theses float past the risk. I m ah, look parenthesis number times and the function size off and the type which is float size of float. In this way we allocated to memory for its element off the array. No one's we've done that. Let's use another for look a nest for look to process the to dairy for Jake zero. They less than number Z plus plus inside the for loop. Let's use it. Bring the function to ask. It's great. You've grade for less soon. Percent. That's D books. Listen, Korma is a blessed one. Now let's use this kind of function to store it's grade in our to the array. So we dive bombers and operator grades. We open brackets inside the brackets with Type I and again brackets and the day inside the Rockets with Opens a i N Z. Because we have a to dairy were given array with, um, elements that are a race but off different length. Because we allocated memory here were created to the array. No, let's some the great without some thank you ALS some plus grades I Z Okay, no, to find the average's grade off its student would go below are in essence for Luke. No one type of reds actuals some over numbers and cynical. But be careful here. We need to cast the divisional to float in order to have ah, correct result. As we explained in the electorate, if you don't remember why we cast the division, go back to luxuriate, Teoh reminded to yourself. OK, no, let's bring the some and the other. Actually, let's bring to the average great of its student. The average grade is percent. That's the box less and coma are actually percentage F. Because our is afloat here at the end of the four loop. Don't forget. Don't forget to little eyes some with zero. Because if you don't the previews values will be at it at the next. Look into the some and finally in orders when their program. We need to release the memory that the way allocated for every element of the array. So we're going to use the free function. But in inside the for loop that goes from I actually zero. I listen five high plus plus and the free function takes us parameter. Then name off very grades. Brackets I. Now let's build around. Our program will succeed. It doesn't want to give the number of lessons to 55 There was greatest. Five Shouldn't give them number of lessons. Three. 14 six The hours grade is 3.6. She had three give the number of pleasures one cry. It was the greatest five. Shouldn't forgive the number of lessons too Then Then there is great. Still you then if I have given a number of lessons for 1237 their average grade is three points. 25. Thank you for watching lecture 35. I hope you enjoyed it and see you in the next section. 37. Lecture 36 Your first structure : Hello and welcome to lecture 36 section line in the section to explain structures. What's this? Tractor structure is a collection of variables under singles name. Mr Actor can contain anything that data time, even another structure to define the structure. You go below the heater and you die. The giver struck, then the name of your strenght opening and closing curly brackets to define the body of the strapped. And after the closing bracket, we get a semi colon toe. Define the end of our struck and inside the body over struck we can hip anybody was type that we want. No, in the following program were great. Distract with name point in the body over struck we defined to float variables float X and flood quiet. So but I struck with name Point, and we did find that the book of Restrict to Flood Vibes Clothes X and float away in the main. We'll create two variables time struck point points and the revivals Hey be this is how we create two variables. Pain be off type struck point A and B part of our business that contain to float viable sits a contains X and why big contents X and Y. Now let's ask from the user to initialize the barbs for strap we use. Bring the function with that. Give X well, going to pay. Then we use this kindness to get the using book because the float with 5% That's if Coleman the Anderson operator. No in order to start the environment in our struck point a bends. You know a lot of the float X Would I pay Doug boxes are hey struck point and picks factors . Taxes on float X. No, we do the same thing before. Why? What I hated Why you save the why drivers on Monday toe assert immediately the viable xto are struck point B. Would that be the text girls builds? Oh so other viable. So the violent or viable? Why for a bass truck spun with that videos? Why? Because you can also add the previews inviolable that stores, you know, eggs device that start rex viable. It's odd. Eight point to this is how we had 5.38 point two with threats. Finally, were you spring this still Time V and they percent of 2% that bucks less said coma may the X called coma B y, for being parades for years and bring this gold i a a. The decks. Crocs is survival X over a striped mind, and they did. Y touches the way viably off strikes boil a Let's face another program. Give extra point day you wife or appoint a for as we can see, vehicles 5.3 and 13.5 they go three. Before we gave this values TWE. Hence Tau Bay. Forgive this value. This is how we access. But we initialize the virus is off our threat. It's a pretty simple and effective way grade programs Thank you for watching this video and see you in the next election. 38. Lecture 37 Typedef in C : hello and welcome to Electoral with seven. In this election, we will see how to use the time. They're freaky work. Instruct with the use off the type deaf keywords we convert environments die in the name of the bottom in a single name no more the days by typing they like this struck gold bloodstains the name off distractedly points by tapping type They're stuck Boynes and doing the ending Carly bracket in the Seven Colon. Would they the name the name in the wage. We want to start the valuable type and we've got every name. Now we define the whole struck ones structure under a singing name point and inside their main function, we can't define who've arable The variables off struck point was name paying to be under the singing name by typing coins a coma be instead of typing struck Going to a B, though under the single name point Well defined barbs envy Oh, off type obstruct But it's without these type deaf keyword Instruct The rest of the cold is similar to the previews exercise. Thank you for watching this video and see you in the next legend 39. Lecture 38 Accessing structures by using pointers : hello and welcome to lecture 38 in this elector, we'll see how the process is trapped with the use of corners. We will use the same court from legs with 37 but we will change some parts in order to process destruction with partners. First, it to declare Point Pastor is a tweets, which means that we have created a boulder that wants to destruct. Stucked born structure. We have created both their that sports toe distract point structure right here. No, before we store values to the vibe is with the use of pointers more needs to use them. I look handsome to allocate memory for her pointer. We don't allocate memory. We simply great the border that we can use it to store violence in the structure drivers. So, hey, because opening fantasies folder asterisk, I am alone. But this is one All of this one time sighs. Off folds pastors, which is the type or forest wrapped the way you know the statement with seven column No, How can we access The bottom is so distracted with the use of wonders in order to get the user in broken story to the variable X with the use of wonders. Would I numbers in the period? Okay. Which is the neighborhood ponder and the environment that we want to start the input of the user Now this still to the computer that the golden off the viable A that once wakes store that volume But the user we give another way to do the same thing. He's toe members on the Bredar close parentheses. What's the risk? The name and why? Which is the other part of your struck point? This with this way we did the same thing we would tell the computer two star in the condoms off a that points to the variable. Why storm the user? That vein book that gets from the user in order so green a We used a i o X and a are away. Let's begin our program and see the results You eggs for what they want. Why so as we can see hey is one and still we gave values give some values toe of our hey, with the use of partners, this is very useful. We're programming and especially in object oriented programming with the simplest glass. So we understand these significant parts off C programming, you will be able to move to new languages that they're very powerful sets as c++. Thank you for watching Leisure 38 and see you in the next legend. 40. Lecture 39 Structures and functions : Hello and welcome to Little 79. This letter grade. A function that returns and instruct. But we will not use type death for that purpose. Where's let's declare a Strapped was going with the name point that takes, you know, the fix and still away? No, inside, let's the glare survives. Three vibes instead of starting point with a it sits to ah by this. Let's set the violence off its strap Some. Hey there, Thanks. They did. Why? Because the note Next PayPal's by. Why? Because one. No, let's declare our function. It's Here's a type struck point. His name so toe struck. Viable. No below remain. It's the planner function. Hold it there, Start told. People love this stuff, too. That's but there's we also create Instruct boils and and let's assign toe the picks. Maybe some oh, next virus off the do part of it distracts you want the X plus B to the thanks. Friends do the same thing for Did y We said this some Oh, why Joe struts and finally with the for Oh, some function well there, Mr No, let's go back inside. Part of me Tends said his tracks, boat and the goat on the function some four destructs aimed the let's use the term to bring the results then is percents. I notice it more and the Kula and away what happens here. We created a function that takes distract balls as parameters and adds the Barbie eggs for the first struck points last the the X variable of the second struck form. And it does the same thing for the way via these It That's the wife our 1st 1 And the sacred book available of the second finally assigns this, uh, the results toe end extended. Why finally, reserves and finally returns the whole struck point. No, in vain. We called the function for our sex once a B woods him, the eggs will pay is the 13 extra vehicles the fortified. So hey, have you actually instruct them? Will be eight And the why off struck him will be two plus 13 Let's build a rattle problem and see the result because we're going to see the ex affinities aids. Kensi, why? Hell is three program works pretty well. Thank you for watching this lecture and see you in the next section. 41. Lecture 40 Read a file: Hello and welcome to lecture 40 In this elector, you explain how to read a text file and display the content of the file to the user. First, let's open a text editor. I hear some blame text. I will open some blame text, and, um, I will write some names that end with a note which will be used as a sign when we did the fund toe change the line in its type Joel note below nick dot lo grace Note. Thirds Note. Some month. Uh, note. No. Let's save our file filed. Save us, Sam. Those txt Remember that the extension has to be dot txt. Let's click Save. We saved the our file to desktop and to know in order to use it to our program, we have to goto products. Click the products filed and right click the eggs acceptable off our program. Then we click Soul Finder. We copay. Let's go to desktop and copy are filed and based it inside the file off our executable. Lookie no, let's go to our lane program. We're going to create a program that reads a fine and, uh, when it finds the dot inside the text will change the line in order to create a program that rates a file in it four steps. The first step is to declare a point there that points to files. So we type fine asterisk in the name of the Pointer, which is FDA in our case. Then we're going to declare a viable car and a car away with name Kyle in good with length 40 in a way to we're going to store the name over the next that the user will give us an import. No, let's years have been the function toe. Ask the user the name of the file. Give the name over the file books. Listen, then we use the get is function toe. Save it toe Are are they or character? Every No. The second step is to open the file and set it to our Pointer FB So we died. Let's be a jewels if open, which is a function that opens the fine, that takes two parameters. The first barometer is the name of the fine. We to start in our final input are a and the second kilometer is the type of, uh, the operation to be executed. We're opening the file here with type, double quotes and inside the double courts who type are they are is for reading the text of the fight. There are several other operations off the F open function, but we cover only two of them in our electors. When we open the files, will we need a control statement to control if the file opened or not. So we type if if b ankles none in this case would take if in the file didn't open. So we bring that that'll and the bucks listen and below return minus one thus to exit the statement. The third step is to read the content of the fight. We said to see the characters off off the file, So we type C A girls and we used the f get see function that takes one parameter. And this is our pointer which point store file. We can read the characters with, ah, a lot of ways, for example, by using the skull F function they get see they get this or other functions that read characters or text. Then we need the while loop to read the file until the end of it. So we type while Wilbur by indices. Well, see, it's not actual to e o F U f means end of file. It is a special key word off the same language that finds the end off the fine inside the wild. Look, we're going to use an if else statement to control. If there is a dot in ah in the fund norther toe change the line hands. It will print all the characters, so we type if see ankles, not bring this. Let's listen New line and good car. We use this function to bring all the other characters, which are the names that are stored in our file. And finally we said to see if I get to see well, the F B at the end off the loop. We said to see the next character. So if ah, the first character is J, this look will be executed because it's not the end of the fan is the first character see actual start? No. So goes to the other cell statement and put the same would start in this it, too, to the concern there goes to the next character and so on until the end of the fine. The fourth in the final step is to close the file by using the function f close that takes that takes US barometer. The pointer that points to the file. This function closes the text that we processed previously. Now let's build on runner program and see the results come Give the name of the fine or fine was named sambal. Don't dx dy. That's presenter. And as we can see the program, Green did the content of the file, which is John, Nick, Greece, George and Samantha. Let's open our text file to see that that we bring it the same content. John John, Neek, NEEK, Chris George and some other Johnny Chris Jordan. Samantha. That's the continent for Find that this. Print it to the console. Let's build another program again and see what happens. Have would type a different name that it prints hair because I can't find the file. Be careful with the file paths. Remember that you have to save the file in the same folder off the acceptable off the code to in order to Ron, Thank you for watching Electro 40 and see you in the next election. 42. Lecture 41 Write in a file: hello and welcome to Elector 41 which is the final programming collector of this course in this lecture will explain how to write in the file and ride the final every time we execute the program. Before we write in a file, we need to create the file. So let's open text editor. I opened sublime text and that I save the empty text with the name Sam Bi, and Extension does 60. I save it to desktop and close, the text said. Then at the left menu off the export inside the Products folder, right click at the Executable File and click Soul Finder, then go to desktop cope with assemble dot txt file and based it insert in the British file with, Ah, inside it. There is the executable file off our program. No, let's go back toe our main file in order to write in the file when it four steps. The first step is, um, to create a pointer that points toe files. So we type file asterisk and the name of the Pointer, which is F B one. The second step is to open the file and said it toe the pointer with the F B one actuals and we die the Function F open. The first parameter of this function is the name over. Filed in the second parameter is the operation that we want to execute when the files opened. So we type aim, which is for writing in a file. This program. It's going to take the user input and write it to the file that we have created. It will take the name of the age of the user. So let's great Connery with the name name as well store the name of the user and a variable editor valuable aids that will store the age of the user. We use the printer function to ask the users Name looks, listen and we use it's gonna function toe get the user input percent It's s coma number sent operator name. We use another Bring the function to ask the users pains you your AIDS in this kind of function to store the users AIDS toe the variable. The third step is to write the user input to our file. To do that, we use the f bring their function. So what type f bring this. The first barometer is the pointer that points to the file, which SB one, the second parameter, is the things that we want to right inside the find. So we open and close double quotes. We want to write the name of the user, so we type percent. That is, bucks, listen and the age of the users. So we type percent. That's the bucks. Listen, in the last parameters are the names of the variables that the user input is started toe. So we type name coma. Eight. The fourth and final step is to close the file with the F close function that takes as parameter the name of the pointer that points to in the file. No, it's been the runner program. Give your name Nick. You're AIDS 22. Program ended with Exit Gold zero. Let's see if our input is written to the file. Let's open the somethingto txt file, and as we can see, the input was written to the file. No, let's close a txt file and go back to our program and re around it. Now let's change the input. Give your name John. Give your AIDS 33 and let's go back toe and let's go back to the fine. The text file. Let's open it. As we can see, uh, Joel, 33 was written. Also toe the file That was a lecturer 41. Thank you for watching this video. I hope you enjoyed it. The scores and see you in the future with more courses.