小编hag*_*ago的帖子

"p =(int [2]){*p};"是什么意思 C指针中的行?

根据我的理解,我将变量的地址传递a给函数int ffx1.

在那之后,这条线究竟p = (int[2]){*p};意味着什么?

int ffx1(int * p)
{
    p = (int[2]){*p};
    return(p[1]);
}

int main()
{
    int a = 1;
    a = ffx1(&a);
    printf("%d", a);

   return 0;
}
Run Code Online (Sandbox Code Playgroud)

c pointers compound-literals

7
推荐指数
2
解决办法
754
查看次数

这段代码中的 else 部分是什么意思?

我正在浏览一些嵌入式编程链接 http://www.micromouseonline.com/2016/02/02/systick-configuration-made-easy-on-the-stm32/

【注意上面链接的代码作者已经更新了代码,delay_ms()文章中的实现不再使用下图所示的解决方案。】

并最终得到以下代码。这是针对 ARM 架构的,但基本上这是一个函数,它会导致作为参数传递的某些毫秒的延迟。所以我可以理解 if 条件,但为什么这里需要 else 条件?有人可以向我解释一下吗?

void delay_ms (uint32_t t)
{
  uint32_t start, end;
  start = millis();//This millis function will return the system clock in 
                   //milliseconds
  end = start + t;
  if (start < end) {
     while ((millis() >= start) && (millis() < end))
     { // do nothing } 
  }
 else{
     while ((millis() >= start) || (millis() < end)) 
     {
      // do nothing
    };
  }
}
Run Code Online (Sandbox Code Playgroud)

c embedded arm

-2
推荐指数
1
解决办法
209
查看次数

标签 统计

c ×2

arm ×1

compound-literals ×1

embedded ×1

pointers ×1