Please give an algorithm to know the memory size in bits.........

Recommended Answers

All 6 Replies

why bits? The smallest addressable memory location is a byte -- usuually 8 bits. And how to get the amount of RAM is operating system dependent.

It looks that u have not understood the question. We can know the memory size in bits using a simple C program, but unfortunately i don't know the algorithm for it :(

>It looks that u have not understood the question.
I don't understand either. I'd wager that the problem isn't with us, it's with your ability to ask a coherent question.

Memory is in bytes, not bits. Don't confuse the two.

Are you trying to ask how to find the size of a variable? For example

char buf[255];

printf("size of buf is %d\n", sizeof(buf));

The sizeof operator (its not a function) can not be used to find the memory size of pointers

char * buf = malloc(255);
// The next line will give you the wrong size
// unless you want the size of a pointer and not
// what it points to.
printf("size of buf is %d\n", sizeof(buf));

Can I do like this?
main()
{
printf("%d",INT_MAX);
}

please give me a C syntax for character testing operations......

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.