Category Archives: GFacts

G-Fact 17

1

Storage class of a variable determines whether the item has a global or local lifetime. In C, typedef is considered as a storage class like… Read More »

G-Fact 16

3

Predict the output of following program. filter_none edit close play_arrow link brightness_4 code #include <stdio.h> int main()  {    int x = 012;    printf(“%d”,  x);    getchar();… Read More »

G-Fact 15

2

Atomic Operation What is an atomic operation? An idea of atomic operation helps in understanding reentrancy, critical section, thread safety, synchronization primitives, etc… (we will… Read More »

G-Fact 14

2.5

In C, a structure cannot have static members, but in C++ a structure can have static members. For example, following program causes compilation error in… Read More »

G-Fact 13

2

const Behaviour in C and C++ In C, the const qualified identifiers will have external linkage, where as in C++ it will have internal linkage.… Read More »

G-Fact 12

1.5

In C, struct keyword must be used for declaring structure variables, but it is optional in C++. For example, following program gives error in C… Read More »

G-Fact 11

1.2

Following relationship holds in any n-ary tree in which every node has either 0 or n children. L = (n-1)*I + 1 Where L is… Read More »

G-Fact 10

Enumeration constants (enum values) are always of type int in C, whereas they are distinct types in C++ and may have size different from that… Read More »

G-Fact 9

The number of structurally different Binary Trees with n nodes is Catalan number Cn = (2n)!/(n+1)!*n! References: http://mathworld.wolfram.com/BinaryTree.html My Personal Notes arrow_drop_up Save

G-Fact 8

2

To uniquely construct a Binary Tree, Inorder together with either Postorder or Preorder must be given (See this for details). However, either Postorder or Preorder… Read More »

G-Fact 7

3

“Pointer arithmetic and array indexing [that] are equivalent in C, pointers and arrays are different” – Wayne Throop References: http://c-faq.com/aryptr/aryptrequiv.html My Personal Notes arrow_drop_up Save