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

📄 ct6

📁 UNIX v6源代码 这几乎是最经典的unix版本 unix操作系统设计和莱昂氏unix源代码分析都是用的该版
💻
字号:
.NHInitialization of Variables.PPAn external variable may be initialized at compile timeby following its name with an initializing valuewhen it is defined.The initializing value has to be something whose value is known at compile time,like a constant..E1int	x	0;	/\** "0" could be any constant \**/int	a	'a';char	flag	0177;int	\**p	&y[1];	/\** p now points to y[1] \**/.E2An external array can be initialized by following its name witha list of initializations enclosed in braces:.E1int	x[4]	{0,1,2,3};		/\** makes x[i] = i \**/int	y[ ]	{0,1,2,3};		/\** makes y big enough for 4 values \**/char	\**msg	"syntax error\\n";	/\** braces unnecessary here \**/char \**keyword[ ]{	"if",	"else",	"for",	"while",	"break",	"continue",	0};.E2This last one is very useful _it makes .UL keywordan array of pointers to character strings,with a zero at the end so we can identify thelast element easily.A simple lookup routine could scan this untilit either finds a match or encounters a zero keyword pointer:.E1lookup(str)		/\** search for str in keyword[ ] \**/   char \**str; {	int i,j,r;	for( i=0; keyword[i] != 0; i\*+) {		for( j=0; (r=keyword[i][j]) \*= str[j] && r != '\\0'; j\*+ );		if( r \*= str[j] )			return(i);	}	return(-1);}.E2.PPSorry _neither local variables nor structures can be initialized.

⌨️ 快捷键说明

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