The marginal area of the pointer part (individual)

Written before:

This sharing is based on the experience gained after completing part of the practice questions.
All personal pointer margins

Experience sharing:

One.

#include <stdio.h>
int main()
{
    
    
char *p="%d,a=%d,b=%d\n";

int a=111,b=10,c;

c=a%b; 
p+=3;//p=p+3;字符数组从a开始输出

printf(p,c,a,b);//另一种写法的翻译:printf("a=%d,b=%d\n",c,a,b);对应输出应该是c与a的值
//其结果为a=1,b=111
}

More interesting printf writing.

two.

#include<stdio.h>
int main()
{
    
    
char *language[ ]={
    
    "FORTRAN", "BASIC", "PASCAL", "JAVA", "C"};
printf("%c",*language[2]);
}

The result of running this piece of code can more clearly understand part of the function of the pointer.

three.


#include<stdio.h>
int main()
{
    
    
	int *p,*s,i,j;
	char *q,ch;
	*p=100;//指针变量p没有地址,就没有储存单元进行数据存储,此类赋值虽不报错但是不合理
	printf("%d\n",*p);
}

This part of the code should belong to the detailed part of the pointer, because the expression *p=100; this type of compiler does not report an error.

Guess you like

Origin blog.csdn.net/yooppa/article/details/115023257