
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
Interesting Facts about C Programming
Here we will see some interesting facts about C programming. These are like below.
- Sometimes the case labels of some switch statement can be placed inside if-else statement.
Example
#include <stdio.h> main() { int x = 2, y = 2; switch(x) { case 1: ; if (y==5) { case 2: printf("Hello World"); } else case 3: { //case 3 block } } }
Output
Hello World
The array[index] can be written as index[array]. The reason is array elements are accessed using pointer arithmetic. The value of array[5] is *(array + 5). If this is in the reverse order like 5[array], then also this is same like *(5 + array).
Example
#include <stdio.h> main() { int array[10] = {11, 22, 33, 44, 55, 66, 77, 88, 99, 110}; printf("array[5]: %d
", array[5]); printf("5[array]: %d
", 5[array]); }
Output
array[5]: 66 5[array]: 66
- We can use <: , :> in the place of square brackets [,] and <%, %> in the place of curly braces {,}.
Example
#include <stdio.h> main() <% int array<:10:> = <%11, 22, 33, 44, 55, 66, 77, 88, 99, 110%>; printf("array[5]: %d
", array<:5:>); %>
Output
array[5]: 66
We can use #include in some strange places. Here let us consider the file abc.txt is holding the line “The Quick Brown Fox Jumps Over The Lazy Dog”. If we include the file after printf statement, we can print that file content.
Example
#include <stdio.h> main() { printf #include "abc.txt" ; }
Output
The Quick Brown Fox Jumps Over The Lazy Dog
- We can ignore the input using %*d in scanf().
Example
#include <stdio.h> main() { int x; printf("Enter two numbers: "); scanf("%*d%d", &x); printf("The first one is not taken, the x is: %d", x); }
Output
Enter two numbers: 56 69 The first one is not taken, the x is: 69
- Related Articles
- Interesting Facts about Java
- Interesting facts about JSON
- Interesting Facts About Golang
- Interesting facts about strings in Python
- Interesting facts about null in Java
- What are some interesting facts about space?
- Interesting facts about Array assignment in Java
- What are some interesting facts about humans?
- C++ bitset interesting facts?
- What are the interesting facts about Computer Viruses?
- What are the interesting facts about the Nobel Prize?
- Interesting facts about Increment and Decrement operators in Java
- Who built the golden temple and what are some interesting facts about it?
- What are some interesting facts about World War 1 that aren't widely known?
- Some Interesting Observations about C/C++ Ternary Operator

Advertisements