Difference between static global and global?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is static data member similar to a global variable?

582


Explain stack unwinding.

637


What is pure virtual function? Or what is abstract class?

592


Differentiate between late binding and early binding.

644


What are the comments in c++?

574






List different attributes in C++?

643


What are the characteristics of friend functions?

567


can any one help to find a specific string between html tags which is changed to a sting.. weather.html looks (for location) is somewhere #include #include #include using namespace std; string find_field(string myPage,string); int main (void) { string page, line, location, temperature; ifstream inputFile("weather.xml"); while(getline(inputFile, line)) { page.append(line); line.erase(); } // Now page is a string that contains the whole xml page // Here you need to write something that finds and // extracts location and temperature from the XML // data in the string page and stores them in // the strings location and temperature respectively location=find_field(page,"location"); temperature=find_field(page,"temp_c"); cout << "Location: "<

1643


When should we use container classes instead of arrays?

583


What does count ++ do in c++?

695


What are the advantages of using a pointer? Define the operators that can be used with a pointer.

604


Difference between pointer to constant and constant pointer to a constant. Give example.

644


What is math h in c++?

607


Write about c++ storage classes?

750


What is endl?

637