ZFGC
Projects => Discussion => Topic started by: joeshmo on April 12, 2006, 04:18:48 pm
-
#include<iostream>;
int main() {
int ted,beth,j;
j=25;
ted=&j;
beth=*ted;
}
It might be just my compiler, which is bloodshed dev-C++, but pointers dont work! It gives me the error:
invalid conversion from int to into
Help me please!
-
Nevermind, I fixed the problem myself. When declaring a pointer it must have a * before it.
Fixed code:
#include<iostream>
int main() {
int * ted;
int beth,j;
j=25;
ted=&j;
beth=*ted;
}
Also I forgot that ; is not needed for the include statement.
-
Just mentioning, you can go: int beth,j,*ted;.
When '*' is used for pointers, you can literally read it as 'whats at the address of', so int * p; would mean int is whats at the address of p;