I have an issue with C++ code. I want to pass argument to my code, but sometimes it will be empty. My code is very simple.
#include <iostream>
int main(int argc, char **argv) {
std::cout << argv[0] << std::endl;
std::cout << argv[1] << std::endl;
}
What I want is to show empty argument in case it is not provided. What I get is
./main
Segmentation fault: 11