Pages1

Showing posts with label C program. Show all posts
Showing posts with label C program. Show all posts

Rounding up a number to power of 2 < number

Using concept of "n&(n-1)" makes value = 0 if n is number with power of 2

#include <stdio.h>
int nextPwrOf2(int num)
{
     do
     {
 

C Programing: Practice questions on computing fundamentals

Interview/practice questions on c computing fundamentals.
Magic of formatting specifier with printf.

Reversing string using recursion: C program

Though there are several ways available in "C" to reverse string; One presented below is using recursion.
------------------------------reversestring.c---------------------------------------
#include<stdio.h>

C program to know "Endianess" of target (Underlying processor)

A C programmer often encounter to a situation where it is impetative to know the underlying processor type;
How processor treat with data while storing in memory in "Little Endian" format or in "Big Endian" format?

Interacting with memory locations directly using C pointer


The real power of  “C” comes from the fact the one can directly access memory location( Port, registers of peripheral etc.) using pointer. Below is the example to perform this operation: