This example is bad. Don’t do this:
(:source lang=c++ filename=pi.cc -inline:)
using namespace std;
int main() {
double nums[] = {0.0, 0.1, 0.2, 0.3, 0.4}; for (int i=0; i<5; i++) cout << nums[i] << " "; cout << '\n'; cout << nums[1] << '\n'; cout << *(nums+1) << '\n'; cout << *(1+nums) << '\n'; cout << 1[nums] << '\n'; double *p = nums+1; cout << p << " " << *p++ << " " << p << " " << *p++ << '\n'; p = nums+1; cout << p << " " << *p++ << " "; cout << p << " " << *p++ << '\n';
} (:sourceend:)
Modified: 2009-03-10T17:27 User: Guest Check: HTML CSSEdit History Source |
Apply to CSU |
Contact CSU |
Disclaimer |
Equal Opportunity Colorado State University, Fort Collins, CO 80523 USA © 2015 Colorado State University |