C++
Which of t ...
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
Which of the following statements are true with respect to references and pointers?
References do not differ from the pointers. It's just a more convenient way of marking pointers.
Unlike pointers, references can not be changed and must be initialized at its declaration or in the constructor initialization list.
Unlike pointers, you can not modify the value of the field referenced by the reference
References can not be used in the list of function arguments.
Explanation
More information:
C++ References
references
pointers
basics
Like
Login in
to like
Comment
Login in
to comment
Share
Tweet
Related Content
Что выведет на экран следующая программа? #include <iostream> void qwer(int &param) { param += 15; } int main(void) { int a = 14; void (*realFunction)(int &) = &qwer; realFunction(a); std::cout << a; return 0; }
Что из перечисленного является объявлением указателя в С++?
#include <iostream> using namespace std; int main() { int a = 3; int b = 4; int c = 5; int &d = b; a = b = c; cout << a << b << c << d << endl; return 0; } Что выведет cout?
Что будет выведено при выполнении кода: #include <iostream> int main() { int x[] = {3,5,8} ; std::cout << (*x)["my string"+3] ; }
Требуется в функции выделить память для переданного указателя. Какая сигнатура подходит для решения этой задачи ? void Init(int** ptr); //1 void Init(int* ptr); //2 void Init(int*& ptr); //3 void Init(int&* ptr); //4
C
++
Quiz
Login to learn C++
or
Read more about
C++ Quizzes
Follow CodeGalaxy
Mobile Beta
Send Feedback
Keep exploring
C++ quizzes
int main() { const int* i = int(); // 1 int const* j = int(); //2 int* const k = int(); //3 int* l(); //4 ++i; //5 ++j; //6 ++k; //7 ++*k; //8 ++l; //9 } Откомпилируется ли такой код? Если нет, то в каких строчках будут ошибки компиляции? После стандарта C++14.
Какой результат работы программы? #include <iostream> using namespace std; void f(double) { cout<<"f1"<<endl; } void f(const int ) { cout<<"f2"<<endl; } void f( int & ) { cout<<"f3"<<endl; } void main(void) { int n = 1; double b = 2; f(n); f(b); }
#include <iostream> using namespace std; int &test() { static int a = 3; return a; } int main() { ++++++test(); cout << test() << endl; return 0; } Что выведет cout?
При истинности какого из приведенных высказываний имеет смысл вычитание указателей?
Какое ключевое слово используется для описания пространства имен?
В чем разница между X x; и X x(); ?
Sign Up Now
or
Subscribe for future quizzes
Login in to like
Login in to comment