摘要:
学习 C 语言的指针既简单又有趣。通过指针,可以简化一些 C 编程任务的执行,还有一些任务,如动态内存分配,没有指针是无法执行的。所以,想要成为一名优秀的 C 程序员,学习指针是很有必要的。 正如您所知道的,每一个变量都有一个内存位置,每一个内存位置都定义了可使用 & 运算符访问的地址,它表示了在内 阅读全文
摘要:
1 //指针 2 3 4 5 #include <stdio.h> 6 int main() 7 { 8 int num = 9; 9 int *ptr_num1 = # 10 11 //int *ptr_num2 = &ptr_num; //指针的地址 12 int **ptr_num2 阅读全文
摘要:
1 #include <stdio.h> 2 int main() 3 { 4 int num1 = 1024; 5 int num2 = 2048; 6 int *ptr1; 7 int *ptr2; 8 9 ptr1 = &num1; 10 ptr2 = &num2; 11 printf("nu 阅读全文
摘要:
1 //打印数组的元素 2 3 4 #include <stdio.h> 5 int main() 6 { 7 8 //数组名就是数组的首地址 9 // double score[] = {69,43,56,48,52}; 10 // printf("数组的首地址:%p\t数组的首元素地址:%p\t 阅读全文
摘要:
1 指针的 -- 2 3 #include <stdio.h> 4 int main() 5 { 6 int i; 7 double score[5] = {10,20,32,40,50}; 8 double *ptr_score; 9 ptr_score = &score[1]; // 20 10 阅读全文
摘要:
1 #include <stdio.h> 2 void main() 3 { 4 int array[]={20,30,40,50,60}; 5 //int *ptr_array; 6 int *ptr_array = array; 7 int i; 8 for(i = 0; i <5;i++) 9 阅读全文
摘要:
1 //数组逆序 2 3 #include <stdio.h> 4 #define N 5 5 int main() 6 { 7 int array[N] = {21,69,85,55,89}; 8 int i; 9 int temp; 10 11 12 //for(i = 0; i< N /2; 阅读全文
摘要:
1 #include <stdio.h> 2 int main() 3 { 4 5 int nums[5][3] = {{10,20,30},{40,50,60},{70,80,90},{100,110,120},{130,140,150}}; 6 int i,j; 7 8 9 // int (*p 阅读全文
摘要:
1 #include <stdio.h> 2 int main() 3 { 4 5 int moneys[6]; 6 char unit[10][4] ={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"}; 7 int i =0; 8 int money,count 阅读全文
摘要:
1 //#include <stdio.h> 2 //#include <ctype.h> 3 //#include <math.h> 4 //#include <stdlib.h> 5 //#include <time.h> 6 7 //int main() 8 //{ 9 10 /* 11 // 阅读全文