Object files are compiled code modules useful to split large code files into small modules to enable to manage them easily. In this article, we are going to discuss the steps to create object files and use them from other code modules. When we compile a program, the ‘C’ compiler will generate object files (“.o” […]
C Programming – Using bitwise operators
‘C’ provides bitwise operators to deal with bits. Each bit is either “0” or “1”. In this article we are going to discuss how to use bitwise operators in ‘C’. ‘C’ provides the following bitwise operators. & (Ampersand – Bitwise AND Operator) | (Pipe Symbol – Bitwise OR Operator) ^ (Cap Symbol – Bitwise XOR […]
C Programming – How to use bit fields in structures?
Structures in C are used to group multiple variables of the same or different types. The variables inside the structures can be accessed through its structure variables. I recommend you to read the article, “C Programming – Understanding Structures in C“, before proceeding with this. Usually, ‘C’ structures are to group related information. ‘C’ compiler […]
C Programming – Dealing with files – How to use open function to open a file?
We have discussed that ‘C’ provides buffered and un-buffered functions for file management. We have already discussed some of the buffered functions in our previous articles; “C Programming – Dealing with files – How to read from a file?“, “C Programming – Dealing with files – How to write to the file?” and “C Programming – Dealing […]
C Programming – Dealing with files – How to fetch a record from the file?
In our previous article, we have used “getrecord” function. We will start this article with this function. We have to implement “getrecord” to fetch a record from the “employee.dat” file. It will check the “employee.dat” file for an employee record based on the given employee number. If it finds the employee record it will return […]
C Programming – Dealing with files – How to write to the file?
We have discussed opening & reading from the file in our previous Article “C Programming – Dealing with files – How to read from a file?“. fwrite function Another important buffered function, ‘C’ provides is fwrite function. fwrite function writes to the file. The file should be opened with fopen function call. The syntax of […]
C Programming – Dealing with files – How to read from a file?
C library provides good number of file handling functions to deal with files and directories / folders. Generally we can classify these functions as: Buffered functions and Un-buffered functions. Un-buffered functions are the raw functions deals directly with storage devices. Whereas, buffered functions maintains memory buffers to improve the performance and reduce the number of […]
C Programming: Passing arguments (command-line arguments) to an application
In ‘C’ programming we can pass arguments to an application or a program. We can call this as passing command-line arguments. I know you will ask the question “How to pass them?”. Good. Fortunately it is simple. As you aware, main() is the function where the execution of the program starts in ‘C’ programming. That means, if […]
C Programming – How to pass variable number of arguments to C / C++ functions?
C/C++ allows to pass variable number of arguments to its functions through variable argument list (va_list). C/C++ provides a series of macros/functions va_start, va_arg, va_end to allow to pass variable number of arguments to its functions. In this article we will discuss how to implement this in C/C++. Step 1. We will prepare a function […]
C Programming – What is the use of gets() and puts() library functions?
Standard C Library provides tons of functions which are very useful and saves a lot of our development time. Through this article we are going to discuss gets() & puts() library functions. Before we start, I would like to mention one important note here which is related to gets() function. gets() function is not recommended […]