#cpp
Read more stories on Hashnode
Articles with this tag
引用运算符(&): 基本引用 #include <iostream> int main() { int a = 10; int& ref = a; // ref 是 a 的引用,ref 和 a 绑定在一起 ref = 20; // 修改 ref 也会修改...
函数声明: 函数声明告诉编译器函数的名称,返回类型和参数列表,但不包含函数体。作用: 让编译器知道函数的存在,以便在定义之前使用(通常用于头文件) 允许代码结构更加清晰(函数声明在前,定义在后)。 语法: 返回类型...
数组 (Array) 数组是固定大小的连续内存块,在编译时确定大小。它们在内存中是静态分配的,意味着大小不可改变。 声明和初始化数组 int arr[5] = {1, 2, 3, 4, 5};...
What is Polymorphism? Polymorphism means “many forms“. In C++, it allows a single function or operator to behave differently depending on the context...
Header Files (.h) Header files are used to declare the interface of our code. Source Files (.cpp): In C++, a source file contain implementations of...