How do I use arrays in c++?



How do I use arrays in c++?..

Answer / Yatheesh Kumar

In C++, you declare an array using square brackets []. For example, int arr[5]; declares an array of 5 integers. To access elements, use the index within the square brackets. For example, arr[0] = 10; sets the first element to 10. You can also initialize arrays at declaration using curly braces {}. For example, int arr[] = {1, 2, 3, 4, 5};

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

Can we change the basic meaning of an operator in c++?

1 Answers  


Define a conversion constructor?

1 Answers  


What is the use of 'using' declaration in c++?

1 Answers  


why c++ is not called strictly d super set of c?

3 Answers   Satyam,


If you want to share several functions or variables in several files maitaining the consistency how would you share it?

1 Answers  


How does list r; differs from list r();?

1 Answers  


How can a '::' operator be used as unary operator?

1 Answers  


What are guid? Why does com need guids?

1 Answers  


How can you force instantiation of a template?

1 Answers   ABC, Amazon,


In c++, what is the difference between method overloading and method overriding?

1 Answers  


Is linux written in c or c++?

1 Answers  


What is a Default constructor?

2 Answers  


Categories