In C++, an unsigned int is a data type that represents non-negative integers. Unlike a regular int, which can hold both positive and negative values, an unsigned int can only hold positive values and zero. This allows it to have a larger range of positive values compared to a signed int.
In C++, primitive data types are the most basic types of data that are built into the language. They serve as the foundation for more complex data structures.
In C++, floating-point types are used to represent real numbers that have fractional parts. They are particularly useful for scientific calculations, graphics, and any application where precision with decimal points is required.
In C++, the boolean type is represented by the keyword bool. A bool variable can hold one of two values: true or false. This type is commonly used in conditions, loops, and logical operations.
In C++, an array is a collection of elements of the same type stored in contiguous memory locations. Arrays are useful for storing multiple values in a single variable, which can be accessed using an index.
contiguous: touching or next to something
C++ also supports multidimensional arrays, such as 2D arrays. For example, int matrix[2][3] declares a 2D array with 2 rows and 3 columns.
In C++, a C-string is a sequence of characters stored in a character array and terminated by a null character ('\0'). C-strings are used for handling text and are compatible with C-style string functions.
C-style string functions are a set of functions provided by the C Standard Library for manipulating and handling C-strings (null-terminated character arrays).
In C++, std:: is a namespace prefix that stands for the Standard Namespace. Namespaces are used to organize code and prevent name conflicts, especially in large projects or when using libraries.
A namespace is an optionally named scope. You declare names inside a namespace as you would for a class or an enumeration. You can access names declared inside a namespace the same way you access a nested class name by using the scope resolution ( :: ) operator.
enumeration: a list of this sort
Use struct for simple data structures where you want all members to be public by default. Use class for more complex data structures where you need encapsulation and private members by default.
encapsulation: the act of expressing the most important parts of something in a few words, a small space or a single object
In C++, a union is a special data type that allows you to store different data types in the same memory location. Unlike struct, where each member has its own memory location, all members of a union share the same memory space. This means that at any given time, a union can hold only one of its members.
In C++, an enum (short for "enumeration") is a user-defined type that consists of a set of named integral constants. Enums are used to assign names to integral values, making the code more readable and maintainable.
std::cout: This is the standard output stream object in the C++ Standard Library. It is used to print data to the console.
<<: The stream insertion operator. It takes the data on its right and sends it to the output stream on its left.
In C++, void is a keyword used to specify that a function does not return a value. It can also be used to indicate that a function does not take any parameters or to declare a pointer to an unknown type.
In C++, a return value is the value that a function gives back to the part of the program that called it. The return value is specified in the function's return type and is provided using the return statement within the function.
Reference are immutable.
Copilot for work
沒有留言:
發佈留言