Information Technology

What is type casting of pointers in C?

  • Type Casting Of Pointers in C can use to switch to another type of process variable. Although all pointers have the same title, we need to determine what kind of data is included in the index. The amount of space the pointer needs to store the address is 32-bit or 64-bit, depending on the device.
  • If the pointer is a 64-bit device, you need 8 bytes of memory and 4 bytes for a 32-bit device. We have the label ‘ptr’, we have a random address, but this does not indicate whether the four addresses are int, duplicate or float. In 64-bit architecture, a point variable consists of 8 bytes, independent of the point.
  • The C compiler needs to know the type of variable because it needs 4 bytes and floats, but they have different configurations, so we have to decide which one we want. Bookmarks can be written from one type to another.

Example

Typecasting of a pointer in C

Output:

output

The variables n and m are int, x, ch and y, char and floats. The pn and pm tags are of type int and start with & n and & m, and the pixel tags, p and pec & x, & y and & ch. Chronometers provide the corresponding value variables. See Results 2 and 3 for results.

Explanation

  • In the example above, use the zero point doctor for the first integer * (int *) GP. Unzip it online
    1. * (Int *) GP
    2. * (full GP)
    3. GP price full point price
    4. Price and Ex
    5. 10
  • Also, using the * (Char *) GP, the next time we add the character ID to the GP. Let’s break it down, too.
    1. * (chr *) doctors
    2. * (GP Character Type Index)
    3. With GP character mark
    4. Value in & ch (where the character ch was changing)

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button