Skip to content

Instantly share code, notes, and snippets.

@mbalayil
mbalayil / del_array_element.c
Created May 18, 2011 11:40
To delete an element from an array
/**
* Program to delete an element from an array
**/
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int *array, size;
@mbalayil
mbalayil / stack.c
Created May 28, 2011 11:05
Stack operations(basic) in C
/**
* A Stack is a last in, first out (LIFO) abstract data type and data
* structure.It is characterized by three fundamental operations: push,
* pop and stack top.
* PUSH : The push operation adds a new item to the top of the stack, or
* initializes the stack if it is empty, but if the stack is full and
* does not contain more space to accept the given item it is considered
* as an Overflow state (It means that the stack is overloaded or no more
* space for new item).
@mbalayil
mbalayil / bit_count_shift.c
Created June 5, 2011 14:59
C program to count the number of bits set in an unsigned integer(shift operator)
/**
* Shift operators shift the bits in an integer variable by a specified
* number of positions. The << operator shifts bits to the left, and the >>
* operator shifts bits to the right. The syntax for these binary operators
* is x << n and x >> n
* Each operator shifts the bits in x by n positions in the specified
* direction. For a right shift, zeros are placed in the n high-order bits
* of the variable; for a left shift, zeros are placed in the n low-order
* bits of the variable.
* Here are a few examples: