Skip to content

Instantly share code, notes, and snippets.

@imryan
Created October 10, 2013 21:49
Show Gist options
  • Select an option

  • Save imryan/6926175 to your computer and use it in GitHub Desktop.

Select an option

Save imryan/6926175 to your computer and use it in GitHub Desktop.
Finding argument count in main method, and playing with a struct.
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
cout << "there are " << argc << " arguments:" << endl;
for (int narg = 0; narg < argc; narg++) {
cout << narg << " " << argv[narg] << endl;
}
struct cat {
bool hasFur;
bool hasTail;
string name;
} mine;
mine.hasFur = true;
mine.hasTail = true;
mine.name = "mr.kitty";
cout << mine.name << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment