Fibonacci 序列产生程序----线程的创建
#include<pthread.h>
#include<stdio.h>
float b[100];
int甚至long long
int都不能满足后面指数般递增的数列,直接float省事儿
int n=100;
void *f()
带参数的函数在创建线程时,各种错误啊,于是换一个
{
int i;
b[0]=0;
b[1]=1;
i=2;
此处为必须的,否则会得不到需要的结果,伤心的往事。。。
while(i<=n)
该循环为主要的计算循环,是傻瓜式的
{
}
}
int main()
{
pthread_t tid;
int a,j,ret;
printf("请输入需要的序列项数:");
用printf输出中文时容易造成乱码,具体方法是对当前c文件另存为UTF-8,即你拿来执行此程序的终端的编码
scanf("%d",&a);
ret=pthread_create(&tid,NULL,f,NULL);
pthread_join(tid, NULL);
while(j<=a){
} 返回值什么的就不要了吧,注释真是开心的事儿
}