how much do you know about C++ ?

let’s take a look,


int will store both types of value positive and negative numeric value. Learn more

char will store only a single character at a time while char[] store character of sequence like a string. we can call char[] by name of character array. Learn more

we can store numeric type value in a char data-type But a character type value will never store in a int data-type. learn more

its depend on situation we can store a mobile number in both data type  int and char. But store mobile number in numeric we have to modifier with int data-type (long int) Because a mobile number has 10 digits and normal int cannot store such a large number. Learn more

  In simple language int can store values around 34000.

 4 Byte,2 Byte,1 Byte.Note: Data Type size depend on system. Learn more.

cout-statement, called Default Output-statement in C++. Learn more.

cin-statement, called input-statement. Learn more.

There is lots of difference but only major difference is OOPs. Learn more. 

Operator in C++

called new line feed operator, used for next line just in a keyboard has enter button.

for dynamically memory allocation in C++.Learn more.

delete operator used to de-locate the memory, allocated by new operator in C++. Learn more.

== used in expression to check value is equal or not whereas = assign a value.

  • First To access the Global variable when the local variable and global variable name are the same. Learn more
  • second use in the outside definition of function-members in structure and class.

to know data-type size in system. Learn more.

* asterisk called value of operator used to hold the address of varaible. Learn more.

in the array, to declare array-variable size. Learn more.

both are Logical type of operators, used for where we join more than one condition together. Learn more.

a type of realational operator name called by LESS THEN AND EQUAL TOLearn more.

Control statement in C++

  • The selection statement consists of multiple blocks and each block executes one-time when the condition is true whereas in the looping-statement,
  • The body-of-loop is executed until the condition becomes false. meaning the body-of-loop repeats until the condition becomes false.

The parentheses bracket is optional for a single statement in the body of a control statement, such as in for-loop, 

 for(intialization; expression; updation)

But the parentheses bracket is used for multiple statements in the body.

for(intialization; expression; updation)

same as with other control statement.

No, only int and char data-type may be used.

  • In both other loops, the first condition is checked, only when true, the body of loop is executed while in do-while
  • the first body of loop is executed and then the condition is checked. learn more.

breaking statement used to terminates an entire program or a single statement in a program. learn more.

exit(0), which is defined inside the stdlib.h header file. Learn more.

The break-statement terminates the execution of the statement while the continue-statement skips the statement.

The break terminates a statement of the program while exit() terminates the entire program.

Array in C++

In a normal-variable, only one value can be stored at a time while in an array-variable multiple values of the same type can be stored at a time. Learn more.

In normal-variable, 5 variables have to be declared (each variable for each number), while in array-variable only one array-variable size is declare to 5.

The character-array is always terminated by a null character, whereas the normal array has no such a condition. so a normal-array will store as many elements as its size, whereas in a character-array, there will be 1 less element store than its size. Learn more

  •  char is a built in data type while array derived data type,
  • The char only store a single character at a time while the character array is a collection of char data type.

Not default. But this is possible indirectly using these two following way,

         Where an array-element is an object and as the collection of object data members and function members means different type of values.

  • Array size is of static type means we can no change array-size at run-time.
  • Array similar are data-type collections. Learn more.

Yes, we can change the array size at run-time using the dynamical memory management in C++.  Learn more.

structure/union in C++

Array is a collection of similar data-types while structure is a collection of both similar and differential data-types. Learn more.

without structure-name structure will called anonymous structure. Here is the program below,


struct { int num; } x;

void main() { cout<<"Enter Number :"; cin>>x.num;  
getch(); }


In C++, structure members can be both types, data members and function members. Here is the Program Store Student detail using Function 

Using dot operator with structure-variable. Here is the syntex,


In C language, The member of a structure cannot be of function type whereas in C++ there is no such a condition. here is program.

When a structure is a variable declared. Only then does the structure take up space in memory. Learn more.

The memory size of a structure is equal to the total of the total sizes of its members.Learn more.

all members of the structure by default are public while all members of the class by default are private. Learn more.



 struct construct
       cout<<"constructor called";

 void main()
   construct x;

but mostly it is not used. The reason is, that all members of the structure are by default public, so in a way there is no need for it.

The structure reserves all its members in a different memory-location in memory, while all members of the union are stored in the same location in memory. Learn more.

Because all members have the same memory address meaning all members are stored in the same location in memory. Learn more.

In a union, the member whose size is higher than other members will be the memory size of the union. here is program.