pr06001.cpp

来自「c++编程宝典源码及Quincy99编译器 是《标准C++编程宝典》电子工业出」· C++ 代码 · 共 37 行

CPP
37
字号
////////////////////////////////////////
// File Name: pr06001.cpp
////////////////////////////////////////
#include <iostream>

////////////////////////////////////////
// The main() function.
////////////////////////////////////////
int main()
{
    // Intrinsic type variables.
    char  c = 'A';
    int   i = 123;
    long  l = 54321;
    float f = 3.45;

    // Pointers.
    char*  cp;    // to char
    int*   ip;    // to int
    long*  lp;    // to long
    float* fp;    // to float

    // Assign variable addresses to pointers.
    cp = &c;
    ip = &i;
    lp = &l;
    fp = &f;

    // Reference the variables through the pointers.
    std::cout <<  *cp << std::endl;
    std::cout <<  *ip << std::endl;
    std::cout <<  *lp << std::endl;
    std::cout <<  *fp << std::endl;

    return 0;
}

⌨️ 快捷键说明

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