_Noreturn 函数说明符用于告诉编译器该函数不会返回任何内容。如果程序内部使用了一些 return 语句,编译器将产生编译时错误。
#include<stdio.h> main() { printf("The returned value: %d</p><p>", function); } char function() { return 'T'; //return T as character }
The program terminates abnormally [Warning] function declared 'noreturn' has a 'return' statement
现在,如果它是一个普通函数,它将正常工作。
#include<stdio.h> int function() { return 86; //try to return a value } main() { printf("The returned value: %d</p><p>", function()); }
The returned value: 86
以上就是在C语言中,_Noreturn函数说明符的详细内容,更多请关注php中文网其它相关文章!
C语言怎么学习?C语言怎么入门?C语言在哪学?C语言怎么学才快?不用担心,这里为大家提供了C语言速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号