Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cs-142:scope [2015/10/13 00:14] (current)
kseppi created
Line 1: Line 1:
 +<code cpp>
 +#include <​iostream>​
 +#include <​string>​
  
 +using namespace std;
 +
 +int foo(int y) {
 +    int x = 3;
 +    return y*x;
 +}
 +
 +
 +int main()
 +{
 +    int x = 4;
 +    cout << "here is an x: " << x << endl;
 +    {
 +        int y = 5;
 +        {
 +            int x = y;
 +            cout << "here is another x: " << x << endl;
 +        }
 +        int x = 6;
 +        cout << "WHY ON EARTH WOULD YOU DO THIS??"​ << foo(x) << endl;
 +    }
 +    ​
 +    char ch;
 +    cin >> ch;
 +    return 0;
 +}
 +</​code>​
cs-142/scope.txt ยท Last modified: 2015/10/13 00:14 by kseppi
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0