进行迭代时,如果我具有以下条件:
while(*pstring)
printf("%c", *pstring++);
似乎按照以下顺序进行操作:
while(*pstring) {
printf("%c", *pstring);
pstring++;
}
或者换句话说,像这样:
while(*pstring)
printf("%c", *(pstring++));
为什么它的行为不像以下方式:
while(*pstring)
printf("%c", (*pstring)++);
答案 0 :(得分:0)
在表达式<?php
$Q = $_GET["q"];
echo $Q;
?>
<?php
if ($Q == '2'){
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.min.js"></script>
<input id ="date_input" dateformat="dd-M-yy" type="date"/>
<span class="datepicker_label" style="pointer-events: none;"></span>
<script type="text/javascript">
$("#date_input").on("change", function () {
$(this).css("color", "rgba(0,0,0,0)").siblings(".datepicker_label").css({ "text-align":"center", position: "absolute",left: "10px",
top:"14px",width:$(this).width()}).text($(this).val().length == 0 ? "" :
($.datepicker.formatDate($(this).attr("dateformat"), new Date($(this).val()))));
});
</script>
<?php
}
?>
中,您使用的是 后递增 运算符(在变量名之后++ ) 。这是先“评估”表达式首先,然后对其进行递增。因此,在这种情况下,var uri = new Uri("http://192.168.4.160:8081/v?time=" + DateTime.Now);
运算符将应用于*pstring++
之前的值。
另一方面,如果您使用了*
,那么您正在使用 预递增 运算符:pstring
的值将在之前递增,其地址由*++pstring
运算符使用。
尝试一下,然后看看(但是要小心,当超出字符串末尾时,可能会遇到不确定的行为)!