Answer to Question #49431 in C++ for vivek

Question #49431
1 What is the difference between 'b' and "b" in c++
2 Why is main function is special ?give two reasons.
3 what does the file iostream.h consist of ?
4 what is a variable ? how many values are associated with it write name of value.
Expert's answer

1) 'b' is the character literal i.e. its type is char. And"b" is the string literal. Its type is char* (or C++ std::string
2) The main function is the program entry point - without itprogram can't be started. Also main has its special signature:
//C examples
int main()
//your code
return 0;//0 if your program ends with success
int main(int argc, char** argv)
//yourcode, where you use command line args stored in argv parameter
return 0;//if success
//Note: Windows doesn't use return value
//C++ examples
//C examples are allowed tooplus:
void main()
//your code
void main(int argc, char** argv)
//your code

3) <iostream.h>(or<iostream>) is standard C++ library. It manages by Input/Output streams,
It has cin, cout, cerr and clog objects, which are the standard I/O streams. It
also has some input and output manipulators(endl, hex, ...). All these items
are contained in namespace called std.
4) Variable is the pseudonym of memory(RAM) cage, thatcontains some type instance. If you want to assign this value to variable with
another(and incastable) type, program will not compiled. There are these
standard types(C++):
bool -> true or false; //C hasn't bool type
char -> 0..255;
short -> -32 768..32 767
int -> -2 147 483 648..2 147 483 647
long -> -9 223 372 036 854 775 808..9 223 372 036 854 775808
float -> 3.4 e +/- 38
double -> 1.7 e +/- 308

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be the first!

Leave a comment

Ask Your question

New on Blog