Code:void main(void)
{
char what[24];
fgets(what,24));
int base; base = atoi(what);
char * address = base;
while(1) printf("%i", (char)*address++);
return;
}
Printable View
Code:void main(void)
{
char what[24];
fgets(what,24));
int base; base = atoi(what);
char * address = base;
while(1) printf("%i", (char)*address++);
return;
}
this is pointing to the converted int, proabally some ram already used. you want to add the '&' sign to base so it points to where it is and not what it holds.Quote:
char * address = base;
>>void main( void )
BADBADBADBADBADBADBADBAD!!!!
Use int main( void ) and return 0;
This code wouldn't compile.
1) This line is wrong:
void main(void)
2) This is wrong:
Do you even listen to your compiler? You have two ')' there when you should just have one.Code:char what[24];
fgets( what,24 ) );
int base; base = atoi(what);
Furthermore, this is C, not C++. As such, you cannot radomly declare new variables wherever you like, unless by some odd chance, you happen to have a C99 compatible compiler.
3) This is also wrong, as described in the first post.
char * address = base;
4) What are you doing?
while(1) printf("%i", (char)*address++);
This code will print out characters (as numbers) forever and ever and ever and ever. And why are you typcasting here? Use %c if you want characters, otherwise, lose the cast. My guess is that you're trying to do something your compiler is warning about, so you're trying to hide the warning.
The above line is also a potential cause of access violation, because of your foolish while loop.
Quzah.
Also
fgets(what,24, stdin);