Required background knowledge: activation record, static scoping & dynamic scoping.
Below is not standard C code. (case1)
foo (double a, double b){ double square (double z) { return z * z; } return square (a) + square (b); } |
Required background knowledge: activation record, static scoping & dynamic scoping.
Below is not standard C code. (case1)
foo (double a, double b){ double square (double z) { return z * z; } return square (a) + square (b); } |
This article summarizes top questions asked about C/C++ pointers on stackoverflow.com. Pointers are the most confusing part of C/C++, those questions use simple examples to explain key pointer concepts.
Consider this example: void send(int *to, int *from, int count) { int n = (count+7)/8; switch(count%8) { case 0: do{*to++ = *from++; case 7: *to++ = *from++; case 6: *to++ = *from++; case 5: *to++ = *from++; case 4: *to++ = *from++; case 3: *to++ = *from++; case 2: *to++ = *from++; case 1: *to++ … Read more
What does ** mean in the following code?
char **argv; |
It declares argv as a pointer that points to a char pointer. It is equivalent to the following code.
char *argv[]; |
Pipe is neat. A pipe is a way to connect the output of one program to the input of another program without any temporary file. This simple test contains a Java program and a C++ program. The output of Java program is used as input for “wc” command, and the output is then used by … Read more
What is a process?
In computing, a process is an instance of a computer program that is being executed. It contains the program code and its current activity. Depending on the operating system (OS), a process may be made up of multiple threads of execution that execute instructions concurrently.
Here is a example showing how to use constructor function in C++.
vs. Overall, dot(.) is for object itself, arrow(->) is for pointer. A good example worth a thousand words. The following example should be a good one. #include <iostream> using namespace std; class Car { public: int number; void Create() { cout << "Car created, number is: " << number << "\n" ; … Read more
Virtual keyword determines if a member function of a class can be over-ridden in its derived classes. Here is a simple example to show this.
Eclipse is a good tool for developing C++ programs in Windows. Setting up the environment sometimes cause problems for a lot of developers. Here are steps that can make it work under your Windows system. 1. update eclipse galileo to helios. 2. add CDT plugin 3. install MinGW 4. Create a sample project, and see … Read more