I've been wondering: what happens to a pointer when it's passed as a parameter to a function? Why is this:
<code>
int main(void) {
char *str;
*str = 'a';
return 0;
</code>
not legal, while this is perfectly legal:
<code>
void function(char *);
void function(char *str) {
*str = 'a';
}
int main(void) {
char *str;
function(str);
return 0;
}
</code>
Thanks
Skarr