# Some Basic C++ questions!

This topic is 4260 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have a number of questions that I was hoping I could through up here, mainly all are clarification request on understanding some principles or syntax clarifications, as opposed to created a new thread for each one: 1)Can someone explain the arguments to the function main in for a CLR program? int main(array<System::String ^> ^args) I have an idea as but would like to know if someone could break down what that argument in the main function is? A CLR array? 2)The following is a line that I understand is creating an CLR array named "saying" containing a wide string with the value that specified in between the "". However, the following explanation after the source line is what is confusing me and hoped someone could explain it better.
String^ saying = L"I used to think I was indecisive but now I'm not so sure";


Note that the type of the string literal is const wchar_t*, not type String. The way the String class has been defined makes it possible for such a literal to be used to create an object of type String. 3)Using the Array::BinarySearch() function - the problem I am having is understanding how the complement bitwise of either the first index position that is greater than the object you are searching for, or the 'Length' property of the array if no element is found to be greater - tells exactly where the position is that the item you are searching would fall or where it is, if found? - What is the "complementing bitwise"? I understand the different bitwise operators and how they work, but how is it actually working out in the Aaray::BinarySearch() function? Thanks in advance for any and all help understanding some of these a little better.

##### Share on other sites
0) Your thread topic does nothing to suggest *managed* C++, or whatever it is that this actually is. :/

1) IIRC, the '^' character indicates a pointer (or pointer-like thing), so you have a pointer to an array of pointers to strings.

2) The text itself, L"blah blah blah", has an actual 'identity' and a type within the program. Its type is not String, but const wchar_t*. However, it is legal to assign a const wchar_t* to a String, because the String class includes instructions for how to make that assignment.

3) That doesn't sound like an exact quote. The other word order, "bitwise complement", seems more likely. This is simply a bitwise negation, like the '~' bitwise operator. I have no idea why they would be doing that to the array index, though. :s