Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


A file a.cpp & B.cpp are complied & linked together in VC++
file a is something like int a =100;, File B is something
like extern a;
main()
{
printf("%d",a);
}what will be the output.a)100,b)linker error,c)complier
error etc etc.

Answers were Sorted based on User's Feedback



A file a.cpp & B.cpp are complied & linked together in VC++ file a is something like int a ..

Answer / shankar

Take an example, if you are working on a C++ project but it
also deals with some existing C functions/libraries.
You want to wrap them in a C++ module or compile them with
other C++ objects without any C++ compiler errors, then you
would declare the C function prototypes in an extern "C"
block to notify the compiler that they would be compiled
along with other C++ functions into one module.

For example:

my_C_CPP_Header.h:

#ifndef MY_C_CPP_HEADER
#define MY_C_CPP_HEADER


/*check if the compiler is of C++*/
#ifdef __cplusplus
extern "C" {
int myOtherCfunc(int arg1, int arg2); /* a C function */
}
#endif

void myCppFunction1(); /* C++ function */
void myCppFunction2(); /* C++ function */

/*check if the compiler is of C++ */
#ifdef __cplusplus
}
#endif

#endif


Now all three functions are comiled into one module by C++
compiler.

So the out put is (a)100.

Is This Answer Correct ?    7 Yes 0 No

A file a.cpp & B.cpp are complied & linked together in VC++ file a is something like int a ..

Answer / ashish chandrakar

It should be compiler 1 compiler error and 1 warning
Error : Undeclared identifier
we have to include stdio.h
Warning: main should return a value; but it assume as return
type as void.

Is This Answer Correct ?    1 Yes 3 No

A file a.cpp & B.cpp are complied & linked together in VC++ file a is something like int a ..

Answer / zerozero

Compiler error

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More VC++ AllOther Interview Questions

Differences between vc 6.0 and vc 7.0

1 Answers   Honeywell,


What is visual c++ 2008 redistributable x64?

0 Answers  


What is the RGB macro used for?

1 Answers  


What is a wizard?

0 Answers  


Which steps are required to add a column to a list view?

2 Answers  


What is microsoft visual c++ 2015 redistributable package x64?

0 Answers  


What is the difference between serialization and deserialization?

4 Answers   Cap Gemini, HCL, MBT,


How can i communicate with two systems one is located some place another is located 100km how from the current systems which protocala i have to use

2 Answers   Invensys,


What is microsoft visual c++ 2008 redistributable?

0 Answers  


what is mean [] inc what is the use of include conio.h in c

1 Answers   BirlaSoft,


What Is InfoViewer?

1 Answers  


What is vcruntime?

0 Answers  


Categories