> Where can I learn about assembly language or how the C++ compiler works? Any book?
I suggest that learning assembly language and understanding the innards of compilers should not be your priority at this stage.
> if you write two programs, one with vector and another with c-style array for only just storing
> and retrieving values, will the compiled code for both these be the same? ... Both have same efficiency?
Assuming that the c-style array is dynamically allocated and resizeable like a vector, the generator code for both should be similar, with comparable performance.
> Is this correct way to declare variable length c-style string?:
1 2 3
|
int max_chars = 100 ; // for example
char* text = new char[max_chars+1] ; // +1 for the sentinel null character
std::cin >> std::setw(max_chars+1) >> text ; // limit the size of input to avoid buffer overflow
|
The correct way is to use
std::string instead of variable length c-style string.
> Or more specifically where can I learn C++ standard?
Learn the most important and useful parts of C++ from a good text book (or two).
For example, Stroustrup mentions this in his introductory text book:
The value of a character, such as 'a' for a, is implementation dependent (but easily
discovered, for example, cout << int('a')). |
Re. the standard:
The standard is not intended to teach how to use C++. Rather, it is an international treaty – a formal, legal, and sometimes mind-numbingly detailed technical document intended primarily for people writing C++ compilers and standard library implementations.
Fortunately, there are lots of good books that do teach how to use C++!
https://isocpp.org/std/the-standard |
A good online C++ reference:
https://en.cppreference.com/w/