Learn C Programming Tutorial for Linux 2: Arrays & Pointers

preview_player
Показать описание
In episode 2 you will learn about Arrays & Pointers.

This tutorial series will teach the basics of C programming, it will also be helpful to those of you who have learned C++ on the Windows platform and are looking to expand your skills in the C and Linux department. As the years go by, many of you will find yourselves moving to Linux or working with Linux. This is especially true if you plan to work in the software development industry. Our forum focuses on Windows game hacking and C++, but we don't have anything on basic C and Linux. This tutorial series will help bridge the gap and provide something a bit different for our viewers.

Timestamp
0:00 Introduction
0:54 Arrays
2:28 Strings as character sequences
7:50 Pointers
12:20 Functions

In the previous coding tutorial that was a intro to c we learned about data types in c. Now, this c programming tutorial will teach you about arrays, strings as character sequences, c pointers and a bit about functions. Then we will learn about dynamic memory in the next episode. We will be using the gnu/linux operating system to practice some linux c++ and learn the c language.

We start by making a simple program that has an integer array with four elements, then we use printf like we did in the last episode to print numbers using format specifiers but in this case we use the index operator to access the numbers of the array we created. It is important to know that we start counting indexes from zero, so for example the last index of an array with 10 elements would be 9. Now that we know about arrays we can finally understand strings. Strings are actually just character arrays, that is an array of type char, and most importantly the string has a null byte at the end because otherwise we would not know where the end of the string is.

Pointers are the one of the most important concepts of the c programming language because pointers among with their operators allows us programmers to have full control of the memory of an application, however it is also very easy to misuse pointers and end up crashing the program if you do not fully understand them. Just like arrays we can index a pointer to access its elements. In the lowest level a pointer is a variable that stores some address, and this could be the address of an integer variable, a function, an array or even another pointer.

This tutorial series is brought to you by @matthew99g.

Post questions and learn more in the official thread:

We are working on 6 videos right now and plan to go much farther. We'll start with a simple Hello World and move onto the good stuff. We will also be sprinkling in some Linux C game hacking videos. We'll do our best to provide a few Linux equivalent to our Windows game hacking videos.

There are a few ways to follow along if you're a Windows user:
-Use Visual Studio Code like in the video, which is cross platform
-You can use Visual Studio also, just add the module for Linux development
-Compile using the Windows Subsystem for Linux
-Run Linux in a Virtual Machine
-Dual Boot Linux

==
Рекомендации по теме