Hello All,

I am new to programming and have several books on starting out with C++.
I was just curious if there was a publication that has a list of codes and there functions and Syntax. Perhaps with examples of how they are used. Kind of like an Encyclopedia?

Thanks, BandM

Dani AI

Generated

Short answer: use a living reference for language and a couple of focused books for explanation. For a compact, up-to-date “encyclopedia” of C++ syntax and the standard library, a maintained online reference is the fastest way to look things up; for deeper reading pick a modern textbook (for example, C++ Primer or The C++ Programming Language) and keep a small pocket reference for quick lookups. As reminded the forum about older compiler help files and as pointed to code archives for examples, those are useful supplements but not the language specification. See the authoritative summary of program startup forms on cppreference. (cppreference.com)

About the specific question asked: argc and argv are simply how the host passes command-line strings into your program. argc is the count (a non‑negative integer) and argv points to an array of argc + 1 C‑string pointers; by definition argv[argc] is a null pointer and, if present, argv[0] normally holds the program name but that is not guaranteed on every platform. Because argc can be zero in some environments, check argc before dereferencing argv[0] if your code depends on it. These constraints and behaviors are specified in the language/host startup documentation. (cppreference.com)

Practical tips: if you don’t need command-line parameters use the no-argument form of main to avoid unused parameters; when you do use them, copy argv[i] into std::string/std::string_view before processing and use a parsing library (getopt, Boost.Program_options, or similar) for anything nontrivial. On Windows, if you need correct Unicode arguments prefer the wide-API entry points or parse the Unicode command line via GetCommandLineW/CommandLineToArgvW. (learn.microsoft.com)

Recommended Answers

All 6 Replies

The C++ help file from Borland is pretty much what you want. It has a fine index, crossreference and lots of code samples. You can download it for free from the Borland website. It is named: bcpp.hlp

Thanks for the info, but I went to the Borland site and could not find that particular download. There was many file to download. you would happen to be able to post the link here? I would greatly appreciate it. :D

Thanks, BandM

That is a little older help file that came with the free Borland C++ compiler. Check this website for more recent downloads of Borland helpfiles:

u can get lotsa source codes on for free

I checked out , It does have a lot of codes, thats for sure. But I'm looking for more of a quick reference book on code, like

int main (int argc, char* argv[])
________^..Whats This.mean?.^

I know what the int main() is, but the int argc, and argv[] is a mystery to me. I know that my VS C++ 6.0 automatically sets these arguments when I choose a simple Application. But it would be nice to have a reference to what they do.

Thanks, BandM :)

>I know that my VS C++ 6.0
Visual C++ 6 is a very poor compiler for C++.

>automatically sets these arguments when I choose a simple Application
Then you should start with an empty project. Unless you're using command line arguments, there's no need to include those parameters in your definition of main.

>But it would be nice to have a reference to what they do.
Sorry, but the only reference that seems like what you want is the C++ standard. It covers the entire language in painful detail.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.