13 June, 2011

Simple but not Simple!!!!!!

#include
main(){
int x=20;
printf("\n%d\t%d\t%d\n",x,x++,++x);
}

What is the o/p of the above prg and plz explain the logic???

02 June, 2011

Simple one!!!!!!

Whats the difference between "typedef"s and MACROs(#define)????

02 May, 2011

Const pointer Vs Pointer to a const

Does any one remember the difference between constant pointer and pointer to a constant.

I have three declaration:

const int *ptr;
int const *ptr;
int *const ptr;










28 April, 2011

Representing binary in C code

Hi all

    It has been a long time... :)

    Hey does any one know if it is possible to add prefix before a number to represent binary

    For example
        unsigned char a = 0xF0;    This is for hexadecimal
       
Is there a similar representation for binary and octal?
I already tried

    unsigned char a = 0b11110000;

It is possible in MPLAB but not with gcc on linux.
Any solutions...???



20 March, 2011

Useful tips in VIM Editore.

1. If you want to split the screen horizontally give command
:split
If you want to split the screen vertically give command
:vsplit
If you want to open an new/other exiting file in splited window give command
:new filename for horizontal window
:vnew filename for vertical window.
If you want to quit all window give command
:qall for quitting without saving the changes
:wqall for quitting with saving the changes
You can use normal quitting command for one particular splitted window like
q,wq
To move between the splitted window , use ctrl+ww

2. Folding techniques:
You can fold a block of code of a long file. The block can be anything like (),{},[]
or may be some code between the lines.
For example:
Suppose this is your code:
#include
.........................
.......
int main(void)
{
----
----
----
for(;;){

-----
-----
}
}

To fold the brackets {} of for loop, keep the cursor at opening bracket of the for loop and then use zfa} command. It will make a fold till the closing of the corresponding bracket. This technique also works form backward.
It means you can keep the cursor at the closing bracket and use command zfa{ .
For closing and opening the folds, move the cursor at the fold and use command za
If you want to fold the codes between particular lines , Use command
:beginning_line,closing_line fold
Give a space between closing line and fold command.You can also use fo instead of fold.

For more details about this folding option just visit the link.
http://www.linux.com/archive/feature/114138