CS253

This file defines the header for each page. An optional "icon" image (I use the textbook):

Replace this with info about this class:

CS253: Problem Solving with C++

Spring 2014

Example Local Static

Links to the various pages for this class:

Wish I could do this: * Schedule

Local Static Variables

#include <iostream>

using namespace std;

unsigned long next_id() {
    unsigned long id=800000000UL;
    return ++id;
}

int main() {
    cout << next_id() << '\n';
    cout << next_id() << '\n';
    cout << next_id() << '\n';
}
  1. Run it
  2. Make id static outside of next_id()
  3. Make id static inside of next_id()

Modified: 2010-09-10T14:39

User: Guest

Check: HTML CSS
Edit History Source
Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2015 Colorado State University
CS Building