I am learning C++ and I created a simple void function that uses char. I prototyped the function up top, defined it in the int main and tried to output "Your name is " x. Can someone tell me why it only tells me "Your name is" and not the x (john) part?
#include <iostream>
#include <cstdlib>
#include <cmath>
void myfun(char x);
int main() {
using namespace std;
char John;
myfun(John);
system("pause");
return 0;
}
void myfun(char x) {
using namespace std;
cout << "Your name is " << x << endl;
}
Wondering why this is getting downvoted...maybe I should stop trying to learn C++ becuase clearly no one wants to help anyone else learn