Hi,
I've been seeing this operator ($) a lot in different sources. What does it do? I searched google and wiki but didn't find any info about it.
Printable View
Hi,
I've been seeing this operator ($) a lot in different sources. What does it do? I searched google and wiki but didn't find any info about it.
I've never seen an operator $ - there are some compiler extensions to support $ as part of the identifiers e.g. you could have a symbol my$var - a bit like _ in that sense.
Edit: are you perhaps referring to the $ used in shell-scripts and PHP to indicate a variable? e.gin php.Code:$foo=7;
--
Mats
This is one of the places where I saw it:
I understand the part where he compiles, but I don't understand the one on the first line.Code:$ cat foo.c
#include <stdio.h>
struct empty {
};
int main ( ) {
printf( "%ld\n", sizeof(empty) );
return 0;
}
$ gcc foo.c
foo.c: In function `main':
foo.c:5: error: `empty' undeclared (first use in this function)
foo.c:5: error: (Each undeclared identifier is reported only once
foo.c:5: error: for each function it appears in.)
$ g++ foo.c
$ ./a.exe
1
Thanks anyway.
Oh, that is not actually part of the code. It is just the shell prompt.
That's like the "C:\>" in a Windows/DOS command shell.
--
Mats
ooooh, OK. Thanks. I've never seen "cat" being used in the shell.
Nowhere. I didn't even know it exists! I've used linux for a while, but I never needed it. What does it do?
Concatenate files together and print them to the command line (or wherever you redirect the output to). Since there is only one file specified, it just prints that file's content.
Good thing the guy that made the example wasn't running as root, otherwise you'd be trying to find a #cat preprocessor directive! ;)
"cat" is equivalent to "type" in a DOS box (but can do a lot more)
Todd