Wednesday, February 15, 2012

Job Switch - Day2


This is actually not day 2 when i started the preparation but due to some other commitments, i was not able to study anything.
Also, since i got some interview call, so thought of studying for that (of course with concentrating on C).

So, Today i studied linked list. Created some programs. I am feeling like a professional programmer (comments, debugs, splitting files).

Now about programs: 
1. Created basic program to create and print link list.
2. Program to swap the alternate nodes on a link list.
3. Reverse the linklist.
4. Adding/Removing nodes in front and at end of list.

Good Learns:
1. using pointer to pointer - a pointer to pointer = pointer pointing to another pointer which is pointing to a location. So we need to allocate memory for pointer to pointer. Then allocate memory for the pointers which the double pointer is pointing.
Eg. 
node** head;
head = malloc(sizeof(node*));
*head=malloc(sizeof(node));
2. efficiently moving with link list. -- handle head scenario seperately. Instead of trying to accommodate the head pointer scenario in the general flow, handle it separately. This reminds me that in some case I may need to do it for last node as well.

3. using gcc to build multiple files together(after this interview thing, i will learn how to create make files). Created a shell for building multiple files in a directory.

Now, Day 3 plan:
1. Devise more programs on linklist, tree, arrays, and strings.
2. Read about file handling.

Labels: , , ,