Difference between revisions of "Intermediate C++ Game Programming Tutorial 3"

From Chilipedia
Jump to: navigation, search
(Created page with "In this two-part tutorial we learn all about pointers and pointer-related bullshits. Part one focuses on the basics--the most common pointer operations and the basic underlyin...")
(No difference)

Revision as of 21:07, 27 May 2017

In this two-part tutorial we learn all about pointers and pointer-related bullshits. Part one focuses on the basics--the most common pointer operations and the basic underlying mechanisms. In part two, we take a look at some less commonly-used but still important pointer operations (pointer arithmetic), as well as some other concepts related to pointers. This tutorial introduces a lot of new concepts and features, but is light on practical examples. In the following tutorials we will get more hands-on practice with pointers, but also make sure to experiment with them on your own after finishing Tutorial 2.

Topics Covered

  • Console I/O with <conio.h>

Video Timestamp Index

Tutorial 3

Notes

This stuff that we're doing here with the strings, don't get the wrong idea. This is not the way forward. We're doing this stuff right now because it makes sense to learn about low-level string bullshit at this point and it gives us a chance to practice out newly-acquired pointer skills. However, using c-strings widely in your code is a terrible idea. They are inconvenient and extremely error-prone. Not sexy at all

One we get our practice in with basic pointer ops, strings, file I/O, and memory management, we will be ditching that caveman shit and upgrading to C++ sexy shits. That means we will be ditching c-strings for std::string sometime in the nearish future. But that doesn't mean you can skip this stuff. If you wanna be top tier programmer, you should have this background info. And sometimes (like when you're interfacing with libraries/APIs for example) you still need to use c-strings, even if only a little.

Homework

Prompt the user to input a positive integer, and then find that number in the Fibonacci sequence. For example, if the user enters the number 9, you should output the 9th Fibonacci number (34) to the console. There's only one catch: you're not allowed to use any library functions except for _putch(), _getch(), and _kbhit().

See also