Difference between static global and global?
Answers were Sorted based on User's Feedback
Answer / mukesh
global variable is accessed in all file by use extern keyword.while static global only visible in file in which it is declared.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / nischal bansal
Static global variable can be used only in the file, it is
declared whereas global variable can be used in other files
also. we have to include the file, in which we have
declared the variable
| Is This Answer Correct ? | 2 Yes | 3 No |
Answer / sheela
hello...
what r all above said is false. global static also can
access using extern in other files.
file 1:
#include<stdio.h>
#include <conio.h>
#include "file2.c"
int a=10;
static int b=20;
main()
{
send();
}
file 2:
#include<stdio.h>
#include<conio.h>
void send()
{
extern int a;
extern int b;
printf("%d%d",a,b);
getch();
}
this program prints both a and b values.. then how can u
say global statics has file scope.
please if anybody knows correct answer give me.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / chitra
static global is fixed.but global variables are changed.
| Is This Answer Correct ? | 7 Yes | 88 No |
Answer / afroz
there is no any diffrence between static and non static
global variable
| Is This Answer Correct ? | 16 Yes | 115 No |
Explain the properties and principles of oop.
What do you mean by const correctness?
Explain the difference between using macro and inline functions?
Write any small program that will compile in "C" but not in "C++"
What is the difference between stack and heap memory?
What is ostream in c++?
What is private, public and protected inheritance?
What is the difference between an enumeration and a set of pre-processor # defines?
i want the NIC programmer-B model papaer pattren, iwant the all model papers?
tell me about yourself ?i want answer for frehers with various exasmples?
What is isdigit c++?
write a c++ program that gives output 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 using looping statement