cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
user name:
password:
Forgot your password?
please wait
try again
cancel
forgot your password?
sign up
log in
[Legacy version]
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
the '#' sign in C++ coding
the '#' sign in C++ coding
Nov 30, 2013 at 11:58am
Nov 30, 2013 at 11:58am UTC
Kubani
(267)
Hi all,
Look at this directive line,
#include "iostream.h"
or
<iostream.h>
What that '#' sign means? And why we need to write it in such lines? And why Stroustrup added it to C++?
Thanks.
Nov 30, 2013 at 12:14pm
Nov 30, 2013 at 12:14pm UTC
Catfish666
(666)
The hash sign
#
is used mostly in preprocessor directives.
The preprocessor is a utility which examines the source code, doing a number of things (out of which probably the most important):
1)
copy-pastes headers
2)
expands macros
Read more here:
http://en.cppreference.com/w/cpp/preprocessor
http://en.cppreference.com/w/cpp/language/translation_phases
Nov 30, 2013 at 2:13pm
Nov 30, 2013 at 2:13pm UTC
Albatross
(4553)
Here's a fun fact. The # being used to indicate a preprocessor directive is something taken from C. Stroustrup didn't add that feature in.
Also, the correct include for the iostream header is <iostream>, not <iostream.h>. Just so you know.
-Albatross
Dec 1, 2013 at 8:25pm
Dec 1, 2013 at 8:25pm UTC
Kubani
(267)
OK mate, thanks for both of you mates.
Topic archived. No new replies allowed.