Posts

Showing posts with the label C

how to implement scheduler in C

The below code is a sample for scheduler implementation in C GitHub Link : https://github.com/vaneeswaran/my_c_codes/tree/master/Shedule

how to check power of 2 in C

The below code will check whether the given number is power of 2 or not Link : https://github.com/vaneeswaran/my_c_codes/blob/master/bit_operations/check_power_of_two.c

how to swap even and odd bits in C

The below code is used to swap the even and odd bits in a 32 bit integer Github Link : https://github.com/vaneeswaran/my_c_codes/blob/master/bit_operations/swap%20even%20and%20odd%20bits%20in%20a%2032%20bit%20integer.c

how to print an integer in binary format

The below is the code to print the given 32 bit integer into binary format Link : https://github.com/vaneeswaran/my_c_codes/blob/master/bit_operations/Print_Integer_binary_format_and_count_0's_1's.c

How to check the machine is little endian or big endian

The below is the code to test the machine is running on little or big endian Github Link :   https://github.com/vaneeswaran/my_c_codes/blob/master/bit_operations/test_little_or_big_endian.c

Linked list operation in C

/* Read Me: # Coded By: # Name:Vaneeswaran N # www.vaneeswaran.com # Description : # The below code will do the following operation in a linked list # 1) Create / Insert Linked List # 2) Delete Linked List # 3) Print Linked List # 4) Sort Linked List # */ Github Link:   https://github.com/vaneeswaran/my_c_codes/blob/master/Linked_List/Linked%20List%20Operations.c

C program for cp command

The below is code for unix cp (copy) command implementation in C Github Link :  https://github.com/vaneeswaran/my_c_codes/blob/master/LSP/cp.c

c program for cat command

The below is code for Unix cat command implementation in C Github Link :  https://github.com/vaneeswaran/my_c_codes/blob/master/LSP/cat.c

how to create a library in c

The below is sample project where string functions are kept in a library. Read Me: Coded By: Name:Vaneeswaran N www.vaneeswaran.com Description : Sample project to demonstrate how to write a C library , build as a shared library and use it Files : main.c - Invokes the functions from the shared library vanees.h - Defines the functions used in the shared library vanees_string.c - Has the implementation of the functions that are used in the shared library gen_lib.sh - This script will compile all files and create a shared library GitHub Link to download : https://github.com/vaneeswaran/my_c_codes/tree/master/How_to_create_a_C_library

Bit Operations in C

The following program explains four basic bit operations. Set a Bit Clear a Bit Toggle a Bit Test a Bit Print the integer in bit format More Functions GitHub :  https://github.com/vaneeswaran/my_c_codes/blob/master/bit_operations/Macro%20Functions%20%26%20Bit%20Operations.c <#Read Me: Developed By: Name:Vaneeswaran N www.vaneeswaran.com #> /* The following program is the sample for bit operation //Header File Declaration #include<stdio.h> #include<string.h> //Macro Definition #define SET_BIT(ipb,n) (ipb|= 1 << n) //ipb is the input byte and n is the position #define CLR_BIT(ipb,n) (ipb &= ~(1<<n)) #define TOG_BIT(ipb,n) (ipb^= 1 << n) #define TEST_BIT(ipb,n) (ipb&=(1<<n)) void print_byte( unsigned int input) { int i; printf( "\nBinary Form:" ); for (i = 0 ; i < 32 ; i++) printf( "%d" ,(((input << i) ...