Saturday, January 11, 2014

[1] Puzzles in Programming in C

Puzzles in Programming  in C  


[1] In C language after declaring an array int a[10]; with sub-scripting variable i, we can also use the array elements as i[a]. 

How?

Example

  #include<stdio.h>
  void main(){
  int a[10]={2,3,4,5,6,7,8,9,10,11};
  int i;
  for(i=0;i<=9;i++){
 printf("%d\n",i[a]);
   }
  }

Output:
2
3
4
5
6
7
8
9
10
11

Note: Use any C compiler and OS for execution

Post a Comment