cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
int x and char(x)
int x and char(x)
Dec 21, 2014 at 7:20pm UTC
CS1
(1)
int x is used for declaration of x and in memory a space is reserved for x variable but what happens when i use char (x)? like i mean what is the concept behind it? please explain in easy words as i am new to programming
THANKS!
Dec 23, 2014 at 4:20pm UTC
TheHardew
(189)
char(x) converts x to char type.
For examlpe this line will print "c" to console 'cuz 99 is code of that leter
std::cout <<
char
(99);
, also this:
1
2
int
x = 99;
char
ch(x);
// the same as char ch = 99;
will set ch to 99 so ch = 'c'
Last edited on
Dec 26, 2014 at 3:07pm UTC
Topic archived. No new replies allowed.