Explore Connect Documentation
Snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// running the program ./my_prog from the Linux terminal
// calls the appropriate main function with parameters a, 1, b, 2
// ./my_prog a 1 b 2
#include <iostream>
using namespace std;
int main(int argc, char **argv) {
  cout << "argc is: " << argc << endl;
  
  for (int i = 0; i < argc; ++i) {
    cout << "argv[" << i << "] is: " << argv[i] << endl;
  }
  
  return 0;
}
Press desired key combination and then press ENTER.