N Ngoc Hue New member Sep 18, 2021 #1 What will be the output of the following C++ code? Code: #include <iostream> #include <string> #include <cstring> using namespace std; int main(int argc, char const *argv[]) { string s("a"); cout<<s; return 0; } A. a B. empty string C. Error D. Segmentation fault
What will be the output of the following C++ code? Code: #include <iostream> #include <string> #include <cstring> using namespace std; int main(int argc, char const *argv[]) { string s("a"); cout<<s; return 0; } A. a B. empty string C. Error D. Segmentation fault
V Vương Tuấn Khải New member Sep 18, 2021 #2 Answer: a Explanation: string class has a constructor for this call hence the string s will be assigned "a". Upvote 0 Downvote
Answer: a Explanation: string class has a constructor for this call hence the string s will be assigned "a".