Click here to Skip to main content
12,304,823 members (65,779 online)
Click here to Skip to main content

Stats

184.2K views
304 downloads
137 bookmarked
Posted

Something You May Not Know About the Switch Statement in C/C++

, 19 Dec 2012 CPOL
A discussion on how switch/case is executed, by reverse engineering in VC++
#include "functions.h"

int main6()
{
    int i =1;

    switch (i)
    {
        case 3: f1(); break;
        case 5: f2(); break;
        case 7: f1(); break;
        case 100: f1(); break;
        case 200: f2(); break;
        case 250: f2(); break;
        case 700: f2(); break;
        case 750: f2(); break;
        case 900: f2(); break;

        default: f3(); 
    }

    return 0;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Zuoliu Ding
Software Developer
United States United States
An Adjunct Faculty and Software Developer in Los Angeles and Orange County, CA

* Typical articles published in Dr. Dobb’s Journal and Windows Developer Magazine:

- A Silent Component Update for Internet Explorer
- Silent Application Update
- An MDI-Style Web Browser and Load Spy Monitor
- Implementing Wireless Print for WinNT/Win2K
- Multi-State Checkbox Tree Views
- A Generic Tool Tip Class
- An Easy Way to Add Tool Tips to Any MFC Control

- More from Google...

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160530.1 | Last Updated 19 Dec 2012
Article Copyright 2010 by Zuoliu Ding
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid