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

📄 llist_test.c

📁 linux下多线程程序设计,包括signals,mutex,simple_once
💻 C
字号:
/********************************************************
 * An example source module to accompany...
 *
 * "Using POSIX Threads: Programming with Pthreads"
 *     by Brad nichols, Dick Buttlar, Jackie Farrell
 *     O'Reilly & Associates, Inc.
 *
 ********************************************************
 * llist_test.c --
 *
 * Exercizer program for linked list
 */
#include "llist.h"
#include <stdio.h>
#include <stdlib.h>

#define MAXDATALEN 40

extern int	main(void) 
{
	llist_t ll;
	char *string;
	int index;
	
	llist_init(&ll);
	
	while (TRUE) 
	{
		printf ("Input index number (or 0 to quit): ");
		scanf ("%d", &index);
		if (index == 0) 
			break;
		string = malloc(MAXDATALEN);
		if (string == NULL) 
			perror("malloc");
		printf ("Input data char: ");
		scanf ("%s", string);
		llist_insert_data(index, string, &ll);
	}
	
	llist_show(&ll);
	
	return 0;
}

⌨️ 快捷键说明

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