While I am passing an string to a void function(string s="nayem"; f(s);) whose argument is a character pointer its't working.Again I'm passing f("Nayem") it wroks,atleast compilation is ok,why this?
#include<bits/stdc++.h>
using namespace std;
void f(char* p)
{
cout<<p<<endl;
}
int main()
{
string s="NAYEM";
f(s);//not working
//but f("nayem"); this compiles
cout<<s<<endl;
return 0;
}