Skip to content

Instantly share code, notes, and snippets.

@Jack2
Created November 2, 2012 02:23
Show Gist options
  • Save Jack2/3998309 to your computer and use it in GitHub Desktop.
Save Jack2/3998309 to your computer and use it in GitHub Desktop.
[C++]page103_example
#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