Will a value live perpetually when there's no reference to it?

前端 未结 8 1222
鱼传尺愫
鱼传尺愫 2021-02-13 07:02

Suppose the following minimal code:

#include 
char character = \'c\';
int main (void)
{
    char character = \'b\';
    printf(\"The current value         


        
8条回答
  •  灰色年华
    2021-02-13 07:51

    Complement to the other answers:

    Try this and you'll understand:

    #include 
    
    char character = 'c';
    
    void Check()
    {
      printf("Check: c = %c\n", character);
    }
    
    int main(void)
    {
      char character = 'b';
      printf("The current value of head is %c\n", character);
      Check();
    }
    

提交回复
热议问题