Elance Exams Answers PDF file

-- PDF FILE --
Download PDF file of elance Zoho Creator Exam Answers
elance-zoho-creator-exam.pdf

Suppose that a global variable "x" of type std::atomic<int> with an initializer parameter of 20 should be added to a header and (if necessary) source file so it is available to all files that include it. How should this be implemented where it will cause neither compile nor linker errors when compiling multiple object files together? Assume that a header guard and #include <atomic> is already present in the header (though not shown in the answers), and that C++11 is enabled.

In header: extern std::atomic<int> x(20);
In header: extern std::atomic<int> x; In source: std::atomic<int> x(20);
In header: extern std::atomic<int> x; In source: std::atomic<int> x = 20;
In header: std::atomic<int> x = 20;
In header: extern std::atomic<int> x; In source: extern std::atomic<int> x(20);
Top
  • Follows us our servcies
  • Facebook icon
  • Linkedin icon
  • twitter icon
  • rss icon
  • social icon