小编Gau*_*ain的帖子

使用%f输出EOF

#include<stdio.h>
int main()
{
    printf("%d",EOF);
}
Run Code Online (Sandbox Code Playgroud)

生成-1这完全没问题,但是

#include<stdio.h>
int main()
{
    printf("%f",EOF);
}
Run Code Online (Sandbox Code Playgroud)

产生0.000.当预期输出为-1.000时,有人能解释这个吗?

c io printf eof format-specifiers

3
推荐指数
2
解决办法
129
查看次数

解除引用NULL指针和未初始化指针之间的区别

在代码块(C++)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int *p;
    cout<<*p;
}
Run Code Online (Sandbox Code Playgroud)

产生垃圾价值,而

#include<bits/stdc++.h>
using namespace std;
int main(){
    int *p=NULL;
    cout<<*p;
}
Run Code Online (Sandbox Code Playgroud)

导致运行时错误.我预计两者的运行时错误(ideone会为两者产生运行时错误),因为两者都是错误的指针.怎么能解释这个呢?

c++ pointers

-7
推荐指数
1
解决办法
270
查看次数

标签 统计

c ×1

c++ ×1

eof ×1

format-specifiers ×1

io ×1

pointers ×1

printf ×1