我对C中的putchar函数有疑问。在我学习期间,我偶然发现了以下声明:
function customDirective() {
return {
scope: {
model: '='
}
link: function(scope) {
scope.resetModel = function() {
scope.model.name = null; //In these lines I was getting the above
scope.model.email = null; //mentioned warning in webstorm.
}
}
}
}
当我编译并执行程序时,结果是BD。我不知道当我们输入function customDirective() {
return {
scope: {
model:'<' // Please refer the above linked angular docs for in detail explanation.
}
link: function(scope) {
scope.resetModel = function() {
scope.model.name = null;
scope.model.email = null;
}
}
}
}
时,结果将是B,但我们是如何获得D的?此函数不能一次返回一个字符吗?
提前致谢
答案 0 :(得分:1)
putchar
正在做两件事:
stdout
由于{B}由putchar
返回,因此它添加了2,使其成为'D'。这将作为参数传递给printf
,然后将“D \ n”写入stdout
。