Difference: 1. The meanings are different. "*p" represents the content stored in the memory address pointed by this pointer. "p" represents the name of a pointer variable, which refers to the memory address pointed by this pointer variable. . 2. The output formats are different. "*p" usually outputs a variable or constant of the same type as the pointer. "p" outputs a hexadecimal number and the address of a pointer. 3. The functions are different. "*p" tells the program to go to that address to retrieve data, and "p" is used to store the address.
The operating environment of this tutorial: windows7 system, c99 version, Dell G3 computer.
Understand *p
, p
In C language, *p and p are commonly used A pointer represents a pointer variable.
If you want to use pointers, you need to first understand addresses and data: you can imagine that there are many boxes, each box has a corresponding number, that number is called "address", and the stuff in the box is called "data" .
p is a pointer variable, used to store the address. You can think of it as the number of the box mentioned above. "*" is the dereference operator. You can think of it as opening the box. p means opening p. No. box and take out the data inside.
To put it simply, remember, p stores the address, and p tells the program to go to that address to retrieve data.
In C language, the * sign has three uses, namely:
The multiplication sign is used for multiplication operations, such as 5*6.
Declare a pointer, used when defining pointer variables, such as int *p;.
Indirect operator, obtains the value in the memory pointed to by the pointer, such as printf("%d",*p);.
The difference between *p
and p
in C language
1. The meanings are different.
*p
represents the content stored in the memory address pointed by this pointer.
p
represents the name of a pointer variable, which refers to the memory address pointed to by the pointer variable.
2. The output format is different
*p
is generally a variable or constant that is consistent with the pointer type.
p
The output is a hexadecimal number and the address of a pointer.
3. Different functions
#*p
Let the program go to that address to retrieve the data.
p stores the address.
#include <stdio.h> int main(void){ int x=3; int *p,*q; p=&x,q=&x; printf("%d\n",*p++); printf("%d\n",(*q)++); printf("%d\n",x); }
The output result is: 3, 3, 4;
Explanation:
Expanded knowledge: *p
and **p
Difference
int *p
: Level one pointer, indicating that the address pointed to by p stores an int type value
int * *p
: Second-level pointer, indicating that the address pointed to by p stores a pointer to type int (that is, the address pointed to by p stores a first-level pointer to int)
For example:
int i=10; //定义了一个整型变量 int *p=&i; //定义了一个指针指向这个变量 int **p1=&p; //定义了一个二级指针指向p指针
Then the way to extract the value of 10 is:
printf("i=[%d]\n",*p); printf("i=[%d]\n",**p1);
C Video Tutorial"
The above is the detailed content of What is the difference between *p and p in C language. For more information, please follow other related articles on the PHP Chinese website!

C# and .NET are suitable for web, desktop and mobile development. 1) In web development, ASP.NETCore supports cross-platform development. 2) Desktop development uses WPF and WinForms, which are suitable for different needs. 3) Mobile development realizes cross-platform applications through Xamarin.

The C#.NET ecosystem provides rich frameworks and libraries to help developers build applications efficiently. 1.ASP.NETCore is used to build high-performance web applications, 2.EntityFrameworkCore is used for database operations. By understanding the use and best practices of these tools, developers can improve the quality and performance of their applications.

How to deploy a C# .NET app to Azure or AWS? The answer is to use AzureAppService and AWSElasticBeanstalk. 1. On Azure, automate deployment using AzureAppService and AzurePipelines. 2. On AWS, use Amazon ElasticBeanstalk and AWSLambda to implement deployment and serverless compute.

The combination of C# and .NET provides developers with a powerful programming environment. 1) C# supports polymorphism and asynchronous programming, 2) .NET provides cross-platform capabilities and concurrent processing mechanisms, which makes them widely used in desktop, web and mobile application development.

.NETFramework is a software framework, and C# is a programming language. 1..NETFramework provides libraries and services, supporting desktop, web and mobile application development. 2.C# is designed for .NETFramework and supports modern programming functions. 3..NETFramework manages code execution through CLR, and the C# code is compiled into IL and runs by CLR. 4. Use .NETFramework to quickly develop applications, and C# provides advanced functions such as LINQ. 5. Common errors include type conversion and asynchronous programming deadlocks. VisualStudio tools are required for debugging.

C# is a modern, object-oriented programming language developed by Microsoft, and .NET is a development framework provided by Microsoft. C# combines the performance of C and the simplicity of Java, and is suitable for building various applications. The .NET framework supports multiple languages, provides garbage collection mechanisms, and simplifies memory management.

C# and .NET runtime work closely together to empower developers to efficient, powerful and cross-platform development capabilities. 1) C# is a type-safe and object-oriented programming language designed to integrate seamlessly with the .NET framework. 2) The .NET runtime manages the execution of C# code, provides garbage collection, type safety and other services, and ensures efficient and cross-platform operation.

To start C#.NET development, you need to: 1. Understand the basic knowledge of C# and the core concepts of the .NET framework; 2. Master the basic concepts of variables, data types, control structures, functions and classes; 3. Learn advanced features of C#, such as LINQ and asynchronous programming; 4. Be familiar with debugging techniques and performance optimization methods for common errors. With these steps, you can gradually penetrate the world of C#.NET and write efficient applications.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)
