为什么输出结构与使用结构相同

时间:2016-02-22 21:18:38

标签: c tcc

我正在使用TCC的latest version(tcc-0.9.26-win64-bin.zip)。出于某种原因,此代码的输出不是我期望的(相同)。

#include <stdio.h>

struct CELL {
  int row;
  int col;
};

typedef struct CELL Cell;

Cell newCell(const int row, const int col) {
    printf("Input %d %d\n", row, col);

    Cell cell;
    cell.row = row;
    cell.col = col;

    return cell;
}

int main(int argc, char *argv[]) {
    Cell cell = newCell(2, 5);

    printf("Output %d %d\n", cell.row, cell.col); 
}

我用:

运行脚本
C:\tcc\tcc.exe -run D:\cell.c
  

它在eval中工作得很好,所以我做错了什么?

1 个答案:

答案 0 :(得分:4)

  

它在eval中工作得很好,所以我做错了什么?

无。使用gcc对我来说很好。