fib.c
来自「8051微控制器的ip 核的vhdl源代码,其中包含了相应的测试程序.」· C语言 代码 · 共 49 行
C
49 行
/* * Copyright (c) 1999 Tony Givargis. Permission to copy is granted * provided that this header remains intact. This software is provided * with no warranties. * * Version : 2.1 *//*---------------------------------------------------------------------------*/#include <reg51.h>/*---------------------------------------------------------------------------*/void fib(unsigned char* buf, unsigned char n) { char i; buf[0] = 1; buf[1] = 1; for(i=2; i<n; i++) { buf[i] = buf[i-1] + buf[i-2]; }}/*---------------------------------------------------------------------------*/void print(unsigned char* buf, unsigned char n) { char i; for(i=0; i<n; i++) { P0 = buf[i]; }}/*---------------------------------------------------------------------------*/void main() { unsigned char buf[10]; fib(buf, 10); print(buf, 10); while(1);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?