Sunday 26 May 2013

0 A C - PROGRAM TO FIND THE WORDLENGHT(without calling function) OF THE HOST MACHINE.

WORD LENGTH :

Word-length (also known as bit-depth) indicates how many digits are used to represent a value in a digital word. For instance, a word-length of 8-bits (8 digits) can only have values from 00000000 to 11111111 (in decimal, 0 to 255). A word-length of 16-bits can have values from 0000000000000000 to 1111111111111111 (0 to 65,536). A digital word doubles in resolution with each bit. For example a 16-bit sample has twice as many possible values (65,536) as a 15-bit word (32,768). 


THE PROGRAM IS :  
#include<stdio.h>
#include<conio.h>
void main()
{
    int count;
    unsigned int n;
    count=0;
    n=~0;
    while(n!=0)
    {
        n=n<<1;
        count++;
    }
    printf("word lenght of the machine is = %d bits \n",count);
    getch();
}


Just copy and paste into your Microsoft Visual C++ or Turbo C (these are program developing software)
Or else you can try this demo file and use it ...
Click HERE to download this file.

(Press ctrl+z and hit Enter to end the program)..
~NOTE~ : While executing if you get any warning then just ignore it and continue with your program...



IF FACE ANY PROBLEM DON'T FORGET TO COMMENT ...!!

Don't Forget to share.... 

Follow on Facebook : Ethical Hacking.

No comments:

Post a Comment