Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What does a pointer value plus an integer value mean in C language?
What does a pointer value plus an integer value mean in C language?
What does a pointer value plus an integer value mean in C language? Can be added, pointer plus integer indicates pointer movement, and the memory cell size occupied by the corresponding type is multiplied by the integer value.

such as

int num = 9;

int * p = & ampnum

Suppose that the current address of P is 0x 1002, and the int type is 2 bytes.

P+num is equal to 0x1002+2 * 9 = 0x1020.

What is a character plus an integer in C language? One character plus an integer equals:

The ASCII code value of a character is added to the integer data, and the result is an integer.

What is the concept of void* pointer plus integer? For example, the default length of the pointer void *p is 4.

If the value (address) of p is 0x00000000.

Then the value of p+n is 0x00000000+n * 4.

Is to get the address of the last n void* pointer in memory.

I wonder if you can understand this article.

What does integer mean in C language? The implementation of C language is generally provided by compilers and standard library developers, and there are many developers in this part. Common compilers are Microsoft vc, GNU G, Borland TC, and Intel also has its own C compiler. Each provider has its own ideas, and may add some new extensions to the language features, such as some keywords, some standard library functions that are not in the standard, or the return values of some standard library functions are different from others. But they all follow the C language standard, that is, we often hear C99, C90/C89, C 1 1 and so on.

A and c standard definitions:

Int type is a series of types. In C language, the basic types of int are char, long, int, short, bool(_Bool keyword, C99). C99 standard stipulates that the realization must be equal to or greater than.

The types defined in all C standards (C99) are as follows:

Character: The smallest address unit on the machine. The header file corresponds to CHAR_BIT, 8 bits; ;

Signed char: The length is the same as that of char, and the range must be at least [- 127,+127], that is, 8 bits, one of which is the sign bit;

Unsigned char: the length is the same as that of char, but it is unsigned bit, and the range size is [0,2 char _ bit-1], with 8 bits; ;

short

Short integer

Signed short

Signed short int: The above four short types are all signed, and they must be able to carry at least the range of [-32767, +32768], that is, the length is at least 16 bit.

Unsigned short integer

Unsigned short integer: the same as short integer, but unsigned, with a length of at least 16 bits.

Internationalorganizations (same as international organizations)

sign

Signed int: Basic int must carry at least [-32767, +32767] range, that is, the length is at least 16 bits.

Unsigned integer

Unsigned: same as int, but unsigned, with a length of at least 16 bits.

long

Long integer

Long signature

Signed long int: an integer of type Long, which must be at least able to carry [-2 147483647, +2 147483647], that is, at least 32 bits in length. (Note: Only one is long)

Unsigned long integer

Unsigned Long Integer: Same as Long Integer, but unsigned.

Longlong

Long integer

Signed Longlong

Signed long long int:long long type, at least capable of carrying [-922337203685475807, +92237203685475807], that is, at least 64bits in length.

Unsigned long integer

Unsigned long long int: same as long long, no sign bit.

What does C language pointer **p mean? Such as int * * p;;

Explanation:

int * p; Then p is the address pointing to the variable of type int, and p is the address;

*p refers to the content.

And int * * p;; P refers to an address, p refers to the address of *p, and *p refers to the address where int is stored.

What does C language pointer mean! A pointer is actually an integer variable. Unlike other data, its function is to store the addresses of other variables, such as.

int a;

int * p = & ampa;

Here, A is an ordinary integer variable, and P is a pointer to store the address of the variable A,

If you do this, you can easily find the position of the variable A and get the value of A..

What does pointer mean in C language? 1. A pointer is 1 variable, which is also the memory space for storing contents. 2. The content stored in the pointer is the starting address of another memory space. Different from ordinary variables, the value of variables is stored. 3. The function of the pointer value operator * is to obtain the value in the memory address stored by the pointer variable. If there is no *, the value stored in the pointer variable (that is, the memory address) will be fetched. Step by step, you will understand.

What does it mean that the function value is an integer in C language? Generally, it refers to five types (including signed and unsigned), such as char, short int, int, long int and long long int, and _Bool type. Of course, it also includes some integer types implemented by the compiler as extensions.

See C 1 1 standard:

[6. 2. 5-4] There are five standard signed integer types, which are designated as signed character, short integer, integer, long integer and long integer. (As mentioned in 6.7.2, these and other types can be specified in several additional ways. There may also be an extended signed integer type that implements the definition. Standard and extended signed integer types are collectively referred to as signed integer types.

[6. 2. 5-6] For each signed integer type, there is a corresponding (but different) unsigned integer type (specified by the keyword unsigned), which uses the same storage (including symbolic information) and has the same alignment requirements. Type _Bool and unsigned integer types corresponding to standard signed integer types are standard unsigned integer types. The unsigned integer type corresponding to the extended signed integer type is the extended unsigned integer type. Standard and extended unsigned integer types are collectively referred to as unsigned integer types.

Extended reading:

C language is a general computer programming language, which is widely used. The design goal of C language is to provide a programming language that can compile and process low-level memory in a simple way, generate a small amount of machine code and run without any support of running environment.

Although C language provides many low-level processing functions, it still maintains good cross-platform characteristics. C language programs written in standard specifications can be compiled on many computer platforms, even including some embedded processors (single chip microcomputer or MCU) and supercomputers.