Aug 16, 2017

SICP# E1.2: Translate formula to prefix notation

SICP# E1.2: Translate formula to prefix notation

Translate the following expression into prefix form

\(\dfrac{5 + 4 + (2 - (3 - (6 + \dfrac{4}{3})))}{3(6 - 2) (2-7)}\)

Aug 15, 2017

SICP# E1.1: Evaluate scheme expression

SICP# E1.1: Evalute scheme expression

Below is a sequence of expressions. What is the result printed by the interpretter in response to each expression ? Assume that sequence is to be evaluated in the order in which it is presented.

Nov 27, 2016

Blog: My life changing YouTube video (FIGHTMEDIOCRITY TOP 9 BOOKS)

Blog #3: My life changing YouTube video (FIGHTMEDIOCRITY TOP 9 BOOKS)
Around 7 months ago I stumbled across a YouTube video by a channel FightMediocrity. I had subscribed to that channel long back, but some how had missed this particular video. You can see the whole video below

It is 17:52 minute long video which lists Fightmediocrity's top 9 books. I highly recommend you to watch the video and then continue reading.

Nov 26, 2016

Blog: Vada

Blog #2: Vada
Saturday and Sunday being the weekends, my wife makes some wonderful breakfast. Weekdays i generally have my breakfast in office cafeteria. Yesterday being a Friday, I made general enquiry to my wife in evening what is special tomorrow for breakfast. She declared it is Vada (It is south indian dish). My wife's preparation of Vada and Sambar (side dish) is the best. If you are interested in making Vada, you can see this youtube video Medu Vada - By VahChef @ VahRehVah.com.

C Programming #91: fileio - fprintf, fscanf

C Programming #91: fileio - fprintf, fscanf

Similarly how there was formatted print function for stdio, there are function that could be used with file. We could apply all the formatting tricks that was used for printf and scanf.

Nov 25, 2016

Blog: Getting started, Why K&R is the best book on C programming?

Blog #1: Getting started, Why K&R is the best book on C programming?
On November 25th 2016 @ 8:20 I have decided that - "I would write a blog daily". My idea is to write on something interesting and fun. It will be on wide range of things including but not restricted to books, technical topic, personal, philosophical, god, daily routine or YouTube videos… My idea is Writing daily would lead to creative life and I can hone my writing skills to too. Making it public is to take criticism and to improve.

K & R : Exercise 2.3 - htoi - hex to integer

K & R : Exercise 2.3 - htoi - hex to integer

Problem

Write the function htoi(s) which converts a string of hexadecimal digits (including an optional 0x, 0X) into its equivalent integer value. Allowable digits are 0..9, a through f, A through F.

Nov 15, 2016

C Programming #90: fileio - fopen, fclose, fgetc, fputc, fgets, fputs

C Programming #90: fileio - fopen, fclose, fgetc, fputc, fgets, fputs

This article go through several API related file operation. Linux/Unix core philosophy is that everything is a file. Hence file operations becomes core of any application/system programming. Hence for a person who claims to be good at 'C' need to know the file operation really well. In this series of article it introduces all the API with example it it never tries to exhaustive, for which you can always refer man pages.

Nov 14, 2016

K & R : Exercise 2.2 - loop equivalent

K & R : Exercise 2.2 - loop equivalent

Problem

Write a loop equivalent to the for loop below without using && or ||.

for(i=0; i < lim -1 && (c=getchar()) != '\n' && c != EOF; ++i)
  s[i] = c;

Sep 8, 2016

C Programming #89: printf - %n specifier

C Programming #89: printf - %n specifier

This article explains format specifier %n which can be used in printf. Already other format specifiers are covered C Programming #87: stdio - printf, scanf and C Programming #88: stdio - insane formating in printf.

Sep 7, 2016

K & R : Exercise 2.1 - Range of char, short, int and long

K & R : Exercise 2.1 - Range of char, short, int and long

Problem

Write a Program to determine the ranges of char, short, int and long variables. Both signed and unsigned by printing appropriate values from standard header and by direct computation. Harder if you compute them determine the ranges of various floating point types.

Sep 6, 2016

C Programming #88: stdio - insane formatting in printf

C Programming #88: stdio - insane formatting in printf

We have covered simple format specifier for printf and scanf here [C Programming #87: stdio - printf, scanf]. This article tries to give incrementally with example most complex and insane formatting that could be achieved. I don't expect you to remember all of it. My idea to here is to show how beautiful and complex the construct are.

Sep 5, 2016

K & R : Exercise 1.24 - Rudimentary C syntax checker

K & R : Exercise 1.24 - Rudimentary C syntax checker

Problem

Write a program to check a C program for rudimentary syntax errors like unbalanced parenthesis brackets and braces. Don't forget about quotes both single and double, escape sequence and comments. (This program is hard, if you do it in full generality).

Sep 4, 2016

C Programming #87: stdio - printf, scanf

C Programming #87: stdio - printf, scanf

Following article explores formatted stdio functions printf and scanf. printf and scanf are varidac function (function that take variable arguments). Variable argument function are covered in later articles.

Sep 3, 2016

K & R : Exercise 1.23 - remove C comments

K & R : Exercise 1.23-remove C comments

Problem

Write a program to remove all comments from a c program, don't forget to handle quoted strings and character constants properly. C comments do not nest.