C Programming Courses Series 1

c programming series 1

What you will learn in this article

What is computer and programming?
Necessary tools for writing the program and addresses you can supply
Algorithm development and a simple example on it
use of the printf function and examples about it


I think anyone with a computer name C and C++ has heard about it at least once. If you are one of those who hear these names, and you are looking for answers to many questions such as what is, what is, what is, how to use them, you are in the right place. Because starting with this article, we will start programming with C and C++. We will continue with C++ after we have reached a certain maturity.

Considering the general nature of our readers, I found it more appropriate to take the subject from the base. So our goal is that a person who doesn’t know how to program is able to reach certain places with what they read here. Those with advanced degrees should wait a little longer to get bored. So, without further ado, let’s begin.

What is computer and programming?

The computer is a machine that performs three main tasks when we consider it very simple. It takes the entered information (input), processes (processing) and subtracts the OUTPUT from the processed data. The computer doesn’t work just as hardware. Because without the software, the hardware doesn’t know what to do. You need a sequence of commands to tell the computer hardware what to do. We can call it a program for the commands that tell him what he’s going to do. So, the hardware, “you do this, then you find the result of the program, or in other words, the software’s job to do something like add here. Knowing more as a programmer is of course an advantage. But you don’t need to know all the features of the computer. A program that you will write for the properties of the computer that you do not know.

The only language the computer understands is the machine language. This is a 16-way programming system. It is very difficult to understand the machine language and you need to know the hardware features of that computer to use it. A very simple function, such as “printf ()”, allows you to write to the screen in C, in machine language 1A BB 0D BC D5 FF C2 F7… like it becomes a much more complex and meaningless state. Machine language is the lowest among programming languages.

The assembler language is followed by the machine language. Assembler, developed on the difficulty and complexity of using machine language, is a simpler structure. But still, compared to C, it is much more difficult and you still need information about the hardware of the computer you are using. Assembler is a complex structure, such as the following.

Don’t waste any time trying to figure it out right now. Because Language C makes our work and therefore our lives much easier. C is a medium-level programming language. This means that you have more access to both easy to write and higher level languages. High-level programming languages such as basic, Pascal, etc. In high-level languages, although relatively easy to write, there are a lot of things we can do with C.

What does it take to write a program?
You don’t need anything to write a program. You can even use Windows Notepad or a program like Gedit, Kwrite on Linux to write a program. The important thing is to compile the program. Compile is called “compile” and compile is called “compiler”. You can find many on the internet for C Compiler. I’m going to run the program through GCC. I also recommend that you install this compiler. GCC is a free software, as is one of the best compilers ever! It is offered by Richard Stallman with the open source code and, if you wish, you have the possibility to make changes to the end.

If you have a Windows operating system, it may be a bit troublesome to install gcc. With a simple google search, I found a program called Bloodshed Dev-C++. He had a structure based on GCC. Windows users who do not want to deal with GCC can try this program.

Algorithm Development

Learning C language and commands is essential to start programming, but you will not create a program unless we can create an algorithm. Algorithm is logic. I mean, what you do, how you do it. There is no method developed to derive the algorithm. For each program, you have to find that method. But don’t worry, the more programs you type, the easier it is for you to set up an algorithm.

Algorithm is the backbone of programming. Commands in C do not work in other languages, such as basic or Fortran. But once you have the logic of programming, you can learn commands from other languages, instead of C commands, and write programs in other languages without any major difficulty.

Let’s consider a simple example. You went to a store, showed the product you bought to the clerk in the vault, you extended the money, you took the change. Let’s change this situation a little bit, which is perfectly normal in everyday life. Let’s have an electronic cashier. If we develop an algorithm according to it,

1-) look at the page;
2 -) Find the product price;
3-) get the money;
4 -) take the price of the product from the money received;
5-) give the remaining money.

Unfortunately, the actions that human intelligence has made automatically do not know the computer and we have to teach it. We do not have the right to make mistakes in teaching because the wrong doctrine results in the wrong programming.

C Programming Language
Basic Input/Output operations (basic I/O)):
We will see many commands/functions related to C in this and the next articles. But what we always use and learn first is basic input and output functions. In C, we use the scanf () function to retrieve a value from the keyboard. To print anything to the screen, the printf () function is used.

Let’s see with an example;

If you write and compile it in your compiler and run it afterwards, Hello world will be written to the screen. #include the standard input and output header file is included in the program. It is extremely routine to include a library in C (and almost all other programming languages). Otherwise, we would have to redefine the input-output functions every time.

If you write and compile it in your compiler and run it afterwards, Hello world will be written to the screen. #include the standard input and output header file is included in the program. It is extremely routine to include a library in C (and almost all other programming languages). Otherwise, we would have to redefine the input-output functions every time.

main () is the main function in a program. After that, the parentheses are standard. Represents a block. The field between the two parentheses creates a block of the main function. printf is a standard function that prints the text we write to the screen. Everything you type in double quotation marks is printed on the screen thanks to printf.

If you notice, we put a semicolon at the end of each line. In fact, it would be better to say that we put a semicolon after each command, not every line. Because semicolon means a C-language command brace.

Now, let’s develop the simple program we wrote above.:

You see a few new lines. Let’s explain what they are in order. We addedN to the end of the “Hello World” article we just wrote. “ n ” means switch to a subline. If we don’t type “n”, the screen will display a “Hello WorldMerhaba world”. if we use “N”, after the “Hello world” is written, we move to the bottom line and the second line prints “Hello World”. You may have noticed a new command called “return 0;” at the bottom. If you do not add it, the program will still run; however, it will warn you. The main function is waiting for an integer to return. You can get rid of these warnings with the return statement We wrote. It’s too early to get to the details, we’il talk about return in the future.

We could write the same program above.:

The screen output of the programs we have written before and now is the same. What I mean by this example is that the printf( ) function will fall to a substring after the place ‘n’ is placed.

As you can see, we did the same thing using a single printf( );

Let’s say we had to write a very long sentence on the screen. for example;

Although this program does not provide any errors, it reduces working efficiency. Because if your writing does not fit in the Editor window, it would be more difficult to read the writing. It may sound trivial, but you can be sure that it will significantly reduce code-writing efficiency.

It is better to write this program as follows::
A single printf () function is used. But by typing alt, we have made the text visible at once. If you compile and run the program, three lines are not written at the bottom. The sentence is shown as a whole and is exactly the same as the previous example. (If we wanted the lines to appear at the bottom, we would have to put ‘n’ as we mentioned earlier.)

https://www.kalogroup.com.au/. Топ актуальных рабочих зеркал букмекерских контор.