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

📄 app2.c

📁 pebble
💻 C
字号:
/* 
 * Copyright 1999, 2000, 2001, 2002 Lucent Technologies Inc.
 * All Rights Reserved.
 * Information Sciences Research Center, Bell Labs.
 *
 * LUCENT TECHNOLOGIES DOES NOT CLAIM MERCHANTABILITY OF THIS SOFTWARE 
 * OR THE SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE. The
 * software is provided "as is" without expressed or implied warranty 
 * of any kind.
 *
 * These notices must be retained in any copies of any part of this
 * software.
 *
 */

/*
 * test stack overflow
 */
#include "pebble.h"

#define	N	100

static char *tos;

void
f(int i)
{
	char x[N];

	printf("call depth=%d: stack at %p size so far=%d\n",
		i, x, tos - x);
	f(i+1);
}


int
main(void)
{
	char x;

	printf("testing Pebble stack overflow\n");
	printf("THIS PROGRAM SHOULD TERMINATE WITH A STACK OVERFLOW MESSAGE\n");
	tos = (char *)&x;

	/* infinite recursion */
	f(1);

	printf("should never reach here!\n");
	task_exit(0);

	return 0;	/* to make gcc happy */
}

⌨️ 快捷键说明

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