Wednesday, February 3, 2010

Number[character array]

Today i'm going to give you a interesting logical programs.

CODING:

#include< stdio.h >
int main()
{
char a[]="INISROH";
printf("%c",4[a]);
return 0;
}

OUTPUT


R


How?


a[i]=*(a+i) (we can represent a[i] using the ptr like this)
*(a+i)=*(i+a)
*(i+a)=i[a]
here 'i' is 0,1,2,...n
n is length of string

0 comments:

Post a Comment