Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 817705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:02:04+00:00 2026-05-15T02:02:04+00:00

I wanted to know if that has any ill effects under any circumsatnce. For

  • 0

I wanted to know if that has any ill effects under any circumsatnce.

For ex:

Ex1:
void* func1()
{
   void* p_ref = NULL;
   //function scope static variable
   static int var1 = 2;
   p_ref = &var1;
   return p_ref;
}
Ex2:

//file scope static variable
static int var2 = 2;

void* func2()
{
   void* p_ref = NULL;
   var2 = 3;
   p_ref = &var2;
   return p_ref;
}

So in the above two cases what is the difference apart from the fact that var1 is function scope and var2 is file scope.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:02:05+00:00Added an answer on May 15, 2026 at 2:02 am

    I don’t believe there is any difference. They’re both global variables, it’s just that the name of the first one is only visible inside the scope of the function func1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to know that if I am doing correctly, regarding retain and release
I wanted to know that how can we find how much time android device
I'm new to PHP programming and I wanted to know that is it possible
We know that we can use a concept Java Package, but I just wanted
i wanted to know if js ws similar to php in the sense that
I wanted to know what is the maximum size of the file that we
I wanted to know the cart total - shipping in the checkout page.So that
This is something that's I've wanted to know recently, mostly out of curiousity. I'm
before I ask my question I wanted to let everybody know that I appreciate
Unfortunately I don't know much networks. I am writing a program that has two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.