简单的c程序不打印输出

simple c program not printing output

我有一个简单的c程序

#include <stdio.h>

int add(int, int);
int add (int a, int b) {
   return a+b;
}

int main(void) {
  int a, b, c;

  printf("Enter the 1st number ");
  scanf("%d",&a);
  printf("Enter the 2nd number ");
  scanf("%d",&b);
  c = add(a, b);
  printf("The value is %d ", c);
  return (0);
}

我正在用cc main.c编译程序 当我 运行 程序 ./a.out
我在控制台中没有得到任何输出。

出于性能原因,对输出进行了缓冲。替换

printf("The value is %d ", c); 

printf("The value is %d\n", c);

或使用fflush(stdout);.

Why does printf not flush after the call unless a newline is in the format string?