Is declaration of variables expensive?

前端 未结 12 982
长情又很酷
长情又很酷 2021-02-01 00:39

While coding in C, I came across the below situation.

int function ()
{
  if (!somecondition) return false;

  internalStructure  *str1;
  internalStructure *str         


        
12条回答
  •  星月不相逢
    2021-02-01 00:57

    If you declare variables after if statement and returned from the function immediately the compiler does not commitment memory in the stack.

提交回复
热议问题