answersLogoWhite

0

When you dereference a pointer you "read" the number of bytes determined by the pointer's type. That is, a char pointer dereferences a single byte while an int pointer dereferences 4 bytes (assuming a 32-bit int) -- regardless of the type actually stored at that address. However, note that a pointer can only actually point at a single byte since it only has storage for a single memory address. How many additional bytes are dereferenced is entirely dependant on the type of the pointer.

To determine how many bytes are actually allocated to an address, use the sizeof operator, passing a dereferenced pointer (the pointer must point at the start of the allocation). If the pointer points at several elements of the same type (an array), then divide the total bytes by the size of the pointer's type to determine the number of elements in the array.

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

Invalid pointer read?

An "invalid pointer read" error typically occurs when a program attempts to access memory that has already been freed or was never allocated. This can lead to undefined behavior, crashes, or data corruption. Common causes include dereferencing null or dangling pointers, buffer overflows, or mishandling memory allocations. To resolve this issue, it's essential to carefully manage memory allocation and deallocation, ensuring pointers are not accessed after being freed.


What is dangling pointer reference?

Whenever memory that was in use, and was referred to by a pointer variable, is freed, and the pointer variable is not updated accordingly (setting it to NULL, for example), the pointer variable is considerred to be a dangling pointer reference.


Major c plus plus feature that were removed from java?

Several features that they either made unsafe programs or hard-to-read programs were removed. Some of the features removed include operator overloading; pointers; implicit conversions between numeric and boolean; multiple inheritance.Several features that they either made unsafe programs or hard-to-read programs were removed. Some of the features removed include operator overloading; pointers; implicit conversions between numeric and boolean; multiple inheritance.Several features that they either made unsafe programs or hard-to-read programs were removed. Some of the features removed include operator overloading; pointers; implicit conversions between numeric and boolean; multiple inheritance.Several features that they either made unsafe programs or hard-to-read programs were removed. Some of the features removed include operator overloading; pointers; implicit conversions between numeric and boolean; multiple inheritance.


How many bytes of date can be addressed by a computer system with an 11-bit address bus and an 8-bit data bus?

There can be one byte of data transferred at one time on the 8-bit data bus, but without knowing more about the architecture and the address and data bus multiplexing we cannot know how many bytes can be addressed.Perhaps the machine architecture uses 2 address bus cycles to send out a 16-bit address and 6-bits of control signals, then uses 2 data bus cycles to read or write the 16-bit word at that address, which would mean this computer system addressed two bytes at one time.Perhaps the machine architecture uses 3 address bus cycles to send out a 32-bit address and a 1-bit control signal, then uses 4 data bus cycles to read or write the 32-bit word at that address, which would mean this computer system addressed four bytes at one time.Perhaps the machine architecture uses 6 address bus cycles to send out a 64-bit address and 2-bits of control signals, then uses 8 data bus cycles to read or write the 64-bit word at that address, which would mean this computer system addressed eight bytes at one time.Perhaps the machine architecture has a variable word length (which could be specified in many different ways depending on the architecture), in which case almost any number of bytes could be addressed at one time (with different numbers of bytes in each addressing operation).There are many other possibilities.


To read data which is superior 1. input stream 2. file reader?

First of all, these two classes are on different levels of abstraction. An InputStream is used for reading any stream of bytes, while a FileReader is used to read characters from a file. If you want to ask between a FileInputStream and a FileReader, then we need to look at what type of data you are reading. If you're reading plain-text file, for example, you want to use a FileReader because it was designed to read in characters. For other types of data, the FileInputStream would be better, as it is used to read in generic streams of bytes from a file.

Related Questions

Invalid pointer read?

An "invalid pointer read" error typically occurs when a program attempts to access memory that has already been freed or was never allocated. This can lead to undefined behavior, crashes, or data corruption. Common causes include dereferencing null or dangling pointers, buffer overflows, or mishandling memory allocations. To resolve this issue, it's essential to carefully manage memory allocation and deallocation, ensuring pointers are not accessed after being freed.


How the computer processes data?

It converts the data into bytes, a form which it can easily read


What is used to read a stream of bytes in a program?

In a program, a stream of bytes is typically read using input/output (I/O) classes or functions provided by the programming language's standard library. For example, in Python, the open() function can be used to open a file in binary mode, and then methods like read(), readline(), or readlines() can be employed to read bytes from it. In Java, classes like FileInputStream or BufferedInputStream are used to read byte streams. These tools facilitate efficient reading and processing of byte data in various applications.


Access violation at address 00402520 in module 'pprotocolo exe' read of address?

The error message "Access violation at address 00402520 in module 'pprotocolo exe'" indicates that the program attempted to read or write to a memory address that it is not allowed to access, leading to a crash. This typically occurs due to issues such as dereferencing null or invalid pointers, buffer overflows, or accessing memory after it has been freed. To resolve this, you may need to debug the application to identify the faulty code or memory management issues, and ensure proper error handling and memory allocation practices are in place.


What is dangling pointer reference?

Whenever memory that was in use, and was referred to by a pointer variable, is freed, and the pointer variable is not updated accordingly (setting it to NULL, for example), the pointer variable is considerred to be a dangling pointer reference.


How can you access the administrator password using pointers in C?

i don't have any knowledge about your ques. but i guide you to read the "Writing TSR through C" & learn knowledge of FAR & HUGE ponters.by this you can access the adminstrator password using pointers in C.


What is MSCam532exe?

You will see MSCams32.exe if you have any of Microsoft Life Cam products installed on your PC. Below is some extra information (from link in related links)MSCamS32.exe is located in a subfolder of "C:\Program Files". Known file sizes on Windows XP are 271,720 bytes (35% of all occurrence), 207,664 bytes, 240,408 bytes, 161,632 bytes, 164,896 bytes, 139,632 bytes, 139,120 bytes, 156,704 bytes. The program is not visible. The file is digitally signed. The file is not a Windows core file. Therefore the technical security rating is 37% dangerous, however also read the users reviews.


How do you explain what near far and huge pointers are to a beginner?

If you're a beginner you don't need to worry about near and far pointers. They are a concept that have been obsoleted on most PCs. If you are programming for an embedded device, read the datasheet. It will explain it in terms of the device you are programming for.


What is acceptable and unacceptable computer practices in south Africa?

read the guide bytes people solution gave you and stop being lazy


Pointers on how to spelled correctly?

pay close attention to whatever you read while looking for mistakes in it & especially study as much latin & greek as possible


How many address lines in Pic16F877A microcontroller?

The PIC16F877A microcontroller has 13 address lines, which allows it to address 8K words of program memory. This enables it to access a range of memory locations for storing instructions. Additionally, it has 368 bytes of data RAM and 256 bytes of Electrically Erasable Programmable Read-Only Memory (EEPROM) for data storage.


When burning a CD what is the difference between 12x and 48x?

How long does it take to write a CD-R or CD-RW disc?The amount of time taken to write a disc depends upon the speed of the recorder, the writing method used by the recorder and the amount of information required to be written. Recording speed is measured the same as the reading speed of ordinary CD-ROM drives and players. At single speed (1x) a recorder writes 150 KB (153,600 bytes) of data (CD-ROM Mode 1) per second and at a multiple of that figure at each speed increment above 1x.CD Read and Write Average Data Transfer Rates(transfer rates indicated in bytes)Read/WriteAudioCD-ROMMode 1CD-ROMMode 2CD-i/XAForm 1CD-i/XAForm 2Speed (CLV)(2,352 Bytes/Block)(2,048 Bytes/Block)(2,336 Bytes/Block)(2,048 Bytes/Block)(2,324 Bytes/Block)1x176,000153,600175,200153,600174,3002x352,800307,200350,400307,200348,6004x705,600614,400700,800614,400697,2006x1,058,400921,6001,051,200921,6001,045,8008x1,411,2001,228,8001,401,6001,228,8001,394,40012x2,112,0001,843,2002,102,4001,843,2002,091,60016x2,816,0002,457,6002,803,2002,457,6002,788,80020x3,520,0003,072,0003,504,0003,072,0003,486,000