Jeetu Alex - IT Software Professional specialized in developing high-end, customized business solutions using Coldfusion and Java.

Coldfusion
Java
JQuery

An online resource for latest web technologies like Coldfusion, JRun, Pro*C, JQuery, HTML5, PHP, W3C, Java, J2EE, C, C++, ORACLE, PL/SQL, MySql, Ajax, Coldbox, Fusebox, UNIX, JavaScript, NodeJS and much more...

Saturday, February 14, 2009

C Programming Tips!

int a,b,c,d;
a=b=c=d=10;

(a>b?a:b)
while(i++>10)a=a+10;
for(i=0;i++<10;)a=a+10;
for(i=0,j=0;i++<10;)a=a+10;
for(;;) infinate loop
for(;a=="";)
break;
continue;

switch(i)
{
case 1:
printf(...
break;

case 2:
....

default:
...
}


goto sos;

sos:
....;

Pointers
========
int i=3,*j,**k;
j=&i;
k=&j;

value 3 of obtained from
i, *(&i), *j, **k

**k = 3+1;
printf(i) gives 4

header file
===========
trigger init and exit functions.
#pragma startup func1
#pragma exit func2


passing an array to a function
==============================
int num[]={1,2,3,4,5};
disp(&num[0],5);//or disp(num,5);//*num or *(num+0) gives zeroth element.


disp(int *j, int n){
for(i=0;i<=n-1;i++)
{printf("%d", *j);j++;}
}

array pointers
==============

s[2][1] equals to
*(s[2] + 1)
*(*(s + 2) + 1)

0 comments :

Post a Comment