本人初学c,遇到一个if语句,不管条件怎么变都输出一个定值,求高手帮助!!!!
程序主要是把数据从一个文本中拷贝到另一个文本中,不论a[236]等于多少 结果都输出y=1,百思不得其解,求各位大侠给予帮助,小弟感激不尽!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#include<stdio.h>
#include <math.h>
#include<stdio.h>
#include<stdlib.h>
long int a[67000];
int main()
{for(;;)
{FILE *fpold,*fpnew;
int sum=0,sum1=0;
char c,g;
int k=0,k1=0;
long int i=0,x,n;
long int ii=0,xx,nn;
long int j;
int y;
fpold=fopen("old.txt","r");
fpnew=fopen("new.txt","w"); sum=0;
while(EOF!=(fscanf(fpold,"%c",&c)))
{
if(c>='0'&&c<='9')
{
sum=sum*10+c-'0';
k++;
}
else
{
if(k>0)fprintf(fpnew,"%d\n",sum);
k=0;
sum=0;
}
}
fclose(fpold);
fclose(fpnew);
freopen("new.txt","r",stdin);
while(scanf("%ld",&x)!=EOF) a[i++]=x;
n=i;
freopen("CON","r",stdin);
printf("num:%ld\n",n);
if(a[236]=256) y=1;
else y=2;
printf("y=%d\n",y)
}
}
不论a[236]等于多少 结果都输出y=1,百思不得其解,求各位大侠给予帮助,小弟感激不尽。