为什么我的这段代码不对?编译不过哦
main()
{
  if (i = abs(sort(a))){
    ........
  }
  else{
    ........
  }
}

解决方案 »

  1.   

    首先你用if (i = abs(sort(a)))就不对,应该是
           if (i == abs(sort(a)))哪个不至于出现错误
    头文件加#include  <stdio.h>了吗?
      

  2.   

    if (i = abs(sort(a)))????
    应该是if(i == abs(sort(a)))
      

  3.   

    if (i = abs(sort(a)))恒为true
    改为
    if (i == abs(sort(a)))
      

  4.   

    对了,有个习惯:
    if(abs(sort(a)) == i)
    这样能够更快检查出
      

  5.   

    各位,人家是编译不过呀
    if (i = abs(sort(a)))又什么不对得呢?我经常这样判断返回值看变量定义没有
    #include "math.h" 没有
    sort定义没有
      

  6.   

    1.#include "math.h"
    2.#include "stdio.h"
    3.if (i==abs(sort(a))) //判断  i=abs(sort(a))是赋值
      

  7.   

    1、头文件要加上:
    #include  <math.h>

    #include  <stdlib.h>2、if (i = abs(sort(a)))
    改为:
    if ( i == abs(sort(a)) )
      

  8.   

    if (i = abs(sort(a)))恒为truewho say this?
    ???
    nonono!
      

  9.   

    sort 是什么函数呀?
    sqrt 倒是知道, 呵呵, 不好意思。
      

  10.   

    还是 quengzi(code) (  ) 兄台细心,我往后写程序也把常量作为左值if( 3 == a )
    肯定不容易出错
      

  11.   

    i=.....是对的,我在赋值。
    sorry.
    sqrt写成了sort!
    结贴!