Question:
what are bit,byte???how long int,char value an address can hold in c?
anonymous
2012-07-03 10:32:34 UTC
i want to know the concept of memory......in case of array address of successive elements differ by 4 in turboc++ why is this so??.......why an address can't store two word while it can store a two digit number?????
Three answers:
anonymous
2012-07-03 11:15:58 UTC
"I want to know the concept of memory" is gibberish.

"I want to learn the basic memory concepts used in computer science." Well then:

Do some research. There are plenty of resources on-line.

Two things you need to understand

1. The actual hardware bus is what limits the size of the memory "piece" that can be accessed at one instant (assuming a single bus). There may be several chips filtering and consolidating the numbers between the CPU and the physical memory.

2. Do not confuse the hardware with the software. (Obviously translation is always possible, but for learning it may be best to keep these two separate). The physical architecture may be quite different from the logic used in C. So, you need to separate the physical byte and bit from the language's use of those terms. When shifting bits, for example, the way a machine actually does that is often not the same from machine to machine. However the result of shifting bits in C will (usually) give the same result. (Otherwise the language would not be portable.)

---

Bbinary arithmetic is the basis of the modern computer. All information can be encoded in binary.

bit is the fundamental component of binary. It is the smallest "atom" of memory and is usually not available alone. It is "on" or "off", 0 or 1, up or down, high or low; depending on what kind of memory (or actually binary information) is being used.

byte is, 99.9% of the time, 8 bits. Some old machines use 6 bits. Some machines allow access to a single byte (see word).

word is 2,4,6, or 8 bytes (up to 64 bits). It is the unit (usually) that is accessible by the cpu from memory. This is (usually) what the cpu processes and is the dimension of the cpu registers.

char

int

long int

are all types in the C programming language. Their size is variable, depending on the compiler and the memory architecture the machine uses. Typically char is a byte and int is two bytes and long int is twice as large as an int, but this is NOT required by the C standard.

A bit can store 0 or 1

2 bits can store the numbers 0,1,2, or 3

8 bits (a (modern) byte) can store 0 - 255

2 bytes 0 - 65535 or - 32767 to +32767 this is implementation dependent.

"...a two digit number?????" !!!!!??? binary digit? octal digit? decimal digit? hexadecimal digit? Don't you know anything???

"an address" is usually a word. my GOD do you really expect to be given everything? - go out an find out. What are you, 12 years old?
James
2012-07-03 17:39:18 UTC
bit:one piece of memory ,not addressable

byte:8 bits ,smallest addressable unit

not a c programmer but a python one!
Shirshendu
2012-07-03 17:38:42 UTC
Integer variable take 2bytes memory and character take 1 byte and also representing integers in binary takes less memory than characters.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...