Skip to content

Instantly share code, notes, and snippets.

@bg1bgst333
Created February 20, 2026 01:13
Show Gist options
  • Select an option

  • Save bg1bgst333/a859b2491cce655a836b8cca9f4e6534 to your computer and use it in GitHub Desktop.

Select an option

Save bg1bgst333/a859b2491cce655a836b8cca9f4e6534 to your computer and use it in GitHub Desktop.
printf#return_value#negative
/* ヘッダファイルのインクルード */
#include <stdio.h> /* 標準入出力 */
/* main関数の定義 */
int main(void){
/* 変数の宣言 */
int ret_e;
/* 標準出力が閉じられている時, printfは失敗する. */
fclose(stdout);
ret_e = printf("ABCDE\n");
if (ret_e < 0){ /* 戻り値が負の値の場合は失敗. */
perror("printf");
}
else{
printf("NO ERROR\n");
}
/* プログラムの終了 */
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment