码迷,mamicode.com
首页 > 系统相关 > 详细

A program to compute word length of a machine

时间:2015-03-30 21:13:43      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:c   计算字长   word length   

Go to my personal blog

There is a program to compute word length of a machine as below.

#include <stdio.h>

int wordlength(void);

int main()
{
    printf("Word Length: %d\n", wordlength());  
    return 0;
}

int wordlength(void)
{
    int i;
    unsigned v = (unsigned)~0;

    for (i = 1; (v = v >> 1) > 0; ++i)
        ;
    return i;
}


A program to compute word length of a machine

标签:c   计算字长   word length   

原文地址:http://blog.csdn.net/abnerwang2014/article/details/44756207

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!