How will you find minimum of three integers without using any comparison operator ?
While comparing a variable with a constant (literal) in C/C++ language, which of the two ways of comparison should we use ? if( x == 2 ) … if( ptr == NULL ) … Or if( 2 == x ) … if( NULL == ptr ) … In the first comparison we are writing variable […]
How will you find the size of a structure in C/C++ language without using sizeof operator. (Note: sum of sizes of all fields of a structure may not be equal to the exact memory allocated to the structure. See, Method-1 in solution).
A process executes the below code: fork(); fork(); fork(); How many child processes will be created ? What is the meaning of fork command ?
sizeof operator returns size in bytes. For example, In an implementation where 2 bytes (16bits) of memory is allocated to an int type, the below code will output 2 int x = 10; printf(“%d”, sizeof(x)); // Output amount of memory allocated to int data type. We talked about the sizeof operator in great detail in the last post. If we […]
sizeof is a unique operator in C/C++ language which returns the amount of memory (in bytes) allocated to its operand. For example, if an implementation stores an integer in 2 bytes then both the statements below will output 2. printf(“%d”, sizeof(int)); int x = 10; printf(“%d”, sizeof x); Note than sizeof operator is used like a […]