Created
November 2, 2012 02:23
-
-
Save Jack2/3998309 to your computer and use it in GitHub Desktop.
[C++]page103_example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
struct Dancer { | |
char name[50]; | |
int age; | |
}; | |
void PrintPersonRef(const Dancer &dcr) | |
{ | |
cout << dcr.name << "는 " << dcr.age << "세 " << endl; | |
} | |
void PrintPersonPtr(const Dancer *dcr) | |
{ | |
cout << dcr->name << "는 " << dcr->age << "세 " << endl; | |
} | |
int main() | |
{ | |
Dancer jack2 = {"Jack2", 26}; | |
PrintPersonRef(jack2); | |
PrintPersonPtr(&jack2); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment