structptr.cpp

来自「C++ sample code, for the book: C++ blac」· C++ 代码 · 共 24 行

CPP
24
字号
#include <iostream>
#include <string>
using namespace std;

int main()
{
    struct structure{
        string text;
        int numbers[100];
    } structure1;

    structure *pointer = &structure1;

    pointer->numbers[5] = 5;
    pointer->text = "Hello from the arrow operator.";

    cout << pointer->text << endl;

    cout << "Here's the value: " << pointer->numbers[5] << endl;
    return 0;
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?