Posts Tagged 'variadic'

A Logger In C

Now I am working on this fair scheduling for my B Tech Project (BTP). Already having written a 1000 lines of code, it is a great pain to debug it. More so if you do not know which function might have caused the error. I needed a logger which could log all the events. The events include entering a function, any important calculation/decision it makes, any return values, so that if my program breaks down I can exactly pinpoint ...

Continue Reading ?
2

Variadic Functions

C is a beautiful language. Though I have been using it for a few years now, I have yet completely mastered it. Just now, I stumbled across what are called variadic functions.

Have you ever wondered how to write functions that take in variable numbers or arguments? Take for instance printf() or scanf(). Both have been implemented in C. These are called variadic functions.

Problem: To construct a function which can take variable number of inputs, eg; printf()

Solution:

Its a simple matter ...

Continue Reading ?
0