cpp01.cpp

来自「C++参考书」· C++ 代码 · 共 43 行

CPP
43
字号

// Coded by plusir -- Dec.28.2002.
// Standard C++ Bible -- (P148-6-1)

#include <iostream>
using namespace std ;

void function( void ) { cout << "hello, world!" << endl ; }

int main()
{
	char c = 'A' ;
	int i = 123 ;
	long l = 54321 ;
	double d = 3.45 ;

	char* cp ;
	int* ip ;
	long* lp ;
	double* dp ;

	cp = &c ;
	ip = &i ;
	lp = &l ;
	dp = &d ;

	cout << *cp << endl ;
	cout << *ip << endl ;
	cout << *lp << endl ;
	cout << *dp << endl ;

	cout << sizeof( cp ) << endl ;
	cout << sizeof( ip ) << endl ;
	cout << sizeof( lp ) << endl ;
	cout << sizeof( dp ) << endl ;

	void( *ifn )( void ) = function ;
	cout << sizeof ( ifn ) << endl ;
	( *ifn )() ;

	return 0 ;
}

⌨️ 快捷键说明

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