我的代码:
#include <iostream>
using namespace std;
int main() {
char *test = (char*)malloc(sizeof(char)*9);
test = "testArry";
cout << &test << " | " << test << endl;
test++;
cout << &test << " | " << test << endl;
return 1;
}
Run Code Online (Sandbox Code Playgroud)
结果:
004FF804 | testArry
004FF804 | estArry
Run Code Online (Sandbox Code Playgroud)
我不明白我是如何移动我的数组指针和地址没有改变的.
我的结构:
struct Point {
int x;
int y;
Point(int nX, int nY) { x = nX; y = nY; }
Point() {};
};
Run Code Online (Sandbox Code Playgroud)
功能:
void functionName(Point target);
Run Code Online (Sandbox Code Playgroud)
我想在函数调用中声明变量:(伪代码)
functionName(Point variable(5,0));
Run Code Online (Sandbox Code Playgroud)
我正在用 C 或 C++ 编写。