⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 g_client.c

📁 C和指针非常好的一本书.里面的有许多代码可以借鉴.
💻 C
字号:
/*
** A client that uses the generic stack module to create two stacks
** holding different types of data.
*/
#include <stdlib.h>
#include <stdio.h>
#include "g_stack.h"

/*
**	Create two stacks, one of integers and one of floats.
*/
GENERIC_STACK( int, _int, 10 )
GENERIC_STACK( float, _float, 5 )

int
main()
{
	/*
	** Push several values on each stack.
	*/
	push_int( 5 );
	push_int( 22 );
	push_int( 15 );
	push_float( 25.3 );
	push_float( -40.5 );

	/*
	** Empty the integer stack and print the values.
	*/
	while( !is_empty_int() ){
		printf( "Popping %d\n", top_int() );
		pop_int();
	}

	/*
	** Empty the float stack and print the values.
	*/
	while( !is_empty_float() ){
		printf( "Popping %f\n", top_float() );
		pop_float();
	}

	return EXIT_SUCCESS;
}

⌨️ 快捷键说明

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