小编pie*_*okr的帖子

C中浮点类型的整数值

#include<stdio.h>
 int main()
 {
   float a;
   printf("Enter a number:");
   scanf("%f",&a);
   printf("%d",a);
   return 0;
 }
Run Code Online (Sandbox Code Playgroud)

gcc在Ubuntu中运行该程序.对于价值观 -

          3.3 it gives value 1610612736 
          3.4 it gives value 1073741824
          3.5 it gives value 0
          3.6 it gives value -1073741824
          4 it gives value 0
          5 it gives value 0
Run Code Online (Sandbox Code Playgroud)

怎么了?为什么打印这些值?我故意这样做,但想了解为什么会这样.详情谢谢!

c floating-point integer

10
推荐指数
1
解决办法
416
查看次数

理解指针和数组

有人可以解释如何通过它的名称引用数组,通过在其名称前加上指针和双指针,如下面的代码所示:

#include<stdio.h>

main()
{  
    int a[3][2];
    a[0][0]=15;
    a[0][1]=150;
    a[1][0]=115;
    a[1][1]=165;
    a[2][0]=135;
    a[2][1]=139;
    printf( "%u\n", a);
    printf( "%u\n", *a);
    printf( "%u\n", **a);
}
Run Code Online (Sandbox Code Playgroud)

c arrays pointers

2
推荐指数
1
解决办法
125
查看次数

标签 统计

c ×2

arrays ×1

floating-point ×1

integer ×1

pointers ×1