Friday, August 28, 2009

The Way I "C" It

C has been one of my favorite language for a very long time. The book I recommend would always be the book by Kernigan & Ritchie. Costing around Rs 100, this book is a steal by any standards.

The reason I got hooked to this book is much credit to Sunil Batra (my C mentor in London). Since my first cover to cover read in 1999 I have gone to read the book 3 times and have tried almost 90% of the excercises in this book.

Can you answer these questions
Read Pg 107 of KR Book for answers
What is this : Int (*daytab) [13])
What is difference between
Void *comp() and Void (*comp) ()
How many argurments in this function ?
List * CreateList (int (* compare)( void * argu1, void * argu2))
In this snippet do we need bracket arond pLoc and why ?
Node **pLoc
pLoc = (* pLoc ) -> Link;

Pg 209 KR Book
Did you know these are not errors ? What Happens ?

F ( a, (t=3,t+2),c) : How many arguments ?

Sample Code
a=3;
b=5;
a=b,c
Printf(“%d”,c); // What gets printed ??

Is this allowed in a for loop : For i=10,j=1;i<10;i++)

Is this allowed and what is result : b,b,a=3,4,a+2,9;

Pg 98
Int a[10];
Int *pa;
Pa=&a[0];
x=*pa; // what is X
Is *(pa+1) same as a[1]
Is *(pa+i) same as a[i]
Is *(a+i) same as a[i]

Which is error ? Why ?
pa=a;pa++;
or
a=pa;a++;

No comments:

Post a Comment