Pointers are very important, this post is a learning note form the cplusplus.com pointer section as well as the Stanford CS library booklet Pointers and Memory (By Nick Parlante, Copyright ©1998-2000, Nick Parlante). The first topic about pointer is how to declare them, how to dereference them, and how to assign a …
To define a function with a variable number of arguments. One solution is to use the cstdarg header file. There are four parts needed:
va_list, stores the list of arguments, va_start, initializes the argument list, va_arg, returns the next argument in the list, va_end, cleans up the variable argument list. Whenever a …
May 15, 2012
2 min read
C++
C++ has two basic stream classes to handle files, ifstream and ofstream. To use them, include the header file fstream. Here is an example:
1#include <fstream>2#include <iostream>3using namespace std; 4 5int main() 6{ 7 char str[10]; 8 9 // Creates an instance of ofstream, and opens example.txt 10 ofstream …