Difference between static global and global?

Answers were Sorted based on User's Feedback



Difference between static global and global?..

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

Difference between static global and global?..

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

Difference between static global and global?..

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

Difference between static global and global?..

Answer / chitra

static global is fixed.but global variables are changed.

Is This Answer Correct ?    7 Yes 88 No

Difference between static global and global?..

Answer / afroz

there is no any diffrence between static and non static
global variable

Is This Answer Correct ?    16 Yes 115 No

Difference between static global and global?..

Answer / priya

static means fixed we should not change anything,but in non
static we can change.

Is This Answer Correct ?    5 Yes 106 No

Post New Answer

More C++ General Interview Questions

Explain static and dynamic memory allocation with an example each.

0 Answers  


What is an orthogonal base class in c++?

0 Answers  


What is Object Oriented programming.what is the difference between C++ and C?

8 Answers   Infosys,


Write a Program to find the largest of 4 no using macros.

0 Answers  


how to swap two numbers with out using temp variable

12 Answers   Global eProcure, TCS,






what is oops and list its features in c++?

0 Answers  


Write a program in c++ to print the numbers from n to n2 except 5 and its multiples

0 Answers   Cankaya University,


Can you use the function fprintf() to display the output on the screen?

0 Answers  


There are 100 students in a class. The management keep information in two tables. Those two tables are given like Roll no Name Age 001 ABC 15 002 XYZ 14 and Roll No Subject Marks 001 Math 75 001 Physics 55 002 Math 68 001 Hindi 69 They want the information like this Roll No Name Hindi Physics Math Total 001 ABC 69 55 75 199 002 XYZ 68 74 84 226 And Roll No Suject Highest 001 Math 98 007 Physics 84 021 Hindi 74 All 275 All information is kept in structure in main memory. You have to find last two tables.

0 Answers  


What do you mean by abstraction. Explain your answer?

5 Answers  


When do we run a shell in the unix system? How will you tell which shell you are running?

0 Answers  


What are the advantages of prototyping?

0 Answers  


Categories