Page 2 of 2

Re:const help

Posted: Tue Oct 15, 2002 4:03 pm
by beyondsociety
Hey tom, I have a few error problems that I need help with in TC. I have only posted one because I replying during class at college. I'll post the rest of my errors tommorow for you to look at. Thanks for the help!.

void GetChar();
{
scanf(stdin,"%c",&Look);
}

I get a Suspicious pointer conversion in function GetChar.

Re:const help

Posted: Tue Oct 15, 2002 4:09 pm
by Schol-R-LEA
Tim Robinson wrote: The OP's use of the ^ character in the original source (e.g. ^G) is the Pascal way of specifying control characters (read ^G as Ctrl+G). ^A is ASCII 1, ^B = 2, ^C = 3, etc. Hence ^I becomes Tab, which is '\t' in C.
Oops, you're right. While it is true that the caret is used for pointer deref, I was mistaken in the syntax, however; the correct syntax is "foo^", not "^foo" as it appears in the code example. Therefore, it cannot be a pointer dereference. While "^foo" is the declaration syntax for pointers, in the context it was clearly setting the TAB character constant, which is, indeed, equal to ctrl-I. Sorry about that.

Re:const help

Posted: Tue Oct 15, 2002 4:56 pm
by beyondsociety
[attachment deleted by admin]

Re:const help

Posted: Wed Oct 16, 2002 7:48 am
by Tom
[attachment deleted by admin]

Re:const help

Posted: Wed Oct 16, 2002 10:51 am
by Whatever5k
Actually, this doesn't fit into this topic, but I'll continue anyway...:
Why do you all introduce comments in C with a double-slash ('//')? This is not C, but C++! In C, there is only the /* and the */. However, gcc supports it - but it's definetely *not* ANSI C. So, better use /* */ so that other compilers don't have problems with that...

Re:const help

Posted: Wed Oct 16, 2002 2:16 pm
by Tim
but it's definetely *not* ANSI C
It is, as of 1999 (the ISO C99 standard).