Si scusami hai ragione!
codice:
#include <iostream>
#define MAXCHAR 10
using namespace std;
char* getChar();
main(){
char* y;
y=getChar();
cout << *y <<" vale" <<y; //Ho paura che il problema sia qui
system("\npause");
return 0;
}
char* getChar(){
int x=0;
char* y=0;
char c[MAXCHAR];
while( cin.get()!= EOF){
c[x]=cin.get();
x++;
}
y = &c[0];
return y;
}
In pratica ho passato un array alla funzione utilizzando il puntatore, ma poi non riesco ad estrarre il contenuto della variabile a cui punta y (Il puntatore ritornato nella funzione getchar)
Scusate la niubbiaggine