SHORT C++ Tutorial Pt1: The Basics
SilentShadowBla (543)

This may be a little confusing for some people...

Short Tutorial on the [The Basics] of C++.

Hope you enjoy!
FULLSCREEN HERE

You are viewing a single comment. View All
DynamicSquid (3608)

there are generally only 2 types of functions, 'void' and 'int'

What about bool?

AmazingMech2418 (910)

@DynamicSquid Well, bool is only in C++. If you are doing C, you can't do bool. However, what I think should be added is char.

DynamicSquid (3608)

@AmazingMech2418 where would you use a char return type?

AmazingMech2418 (910)

@DynamicSquid Well, I've at least used the char* type for strings in C, but the base of that is char.

DynamicSquid (3608)

@AmazingMech2418 Oh character pointers! I though you were just referring to regular char. Yeah, I guess that's true

anotherthel (0)

@AmazingMech2418 Yeah c is weird im pretty sure you have to include stdbool.h or something

AmazingMech2418 (910)

@anotherthel I just use 1 and 0 to represent true and false in C.

anotherthel (0)

@AmazingMech2418 oh. i didnt know that i use c++.

DynamicSquid (3608)

@anotherthel C++ also supports 0 and 1 as false and true

anotherthel (0)

oh i just use true false asa its included @DynamicSquid

DynamicSquid (3608)

@anotherthel yeah same, I don't like the look of 1s and 0s

AmazingMech2418 (910)

@DynamicSquid WOW! That was a lot faster than I thought it would be... I thought it would be like a month until I got 100 cycles. Also, thank you!

CSharpIsGud (595)

@DynamicSquid char's can hold single characters when you don't need a string or a pointer, and char's in C and C++ represent bytes

DynamicSquid (3608)

@CSharpIsGud yeah I know that... were you responding to this comment: "where would you use a char return type?"

For that I meant where would you commonly use a char return type?

CSharpIsGud (595)

@DynamicSquid Anywhere you need to return a byte, or just to represent a character. like a function to read a byte from something

DynamicSquid (3608)

@CSharpIsGud Well yes, I know that, but what I mean by "main" ones are functions with another purpose. I guess it really depends on how you define "main" but for me "bool" is a major one since STL algorithms and stuff. "void" is also a major one. It really depends