随笔分类 - C Primer Plus
摘要:#include <stdio.h> #include <stdlib.h> int main() { char * spt = " 1100100.1111end...."; printf("将字符串%s转成数值类型: 2int:%d 2long:%ld 2double:%f\n", spt, a
阅读全文
摘要:#include <stdio.h> #include <string.h> int main(int argc,char * arr[]) { //当前脚本的输入参数的计数 printf("当前脚本输入的个数为:%d\n",argc ); //接收的参数内容为,只能接受字符串,用空白符分割,格式为
阅读全文
摘要:#include <stdio.h> #include <string.h> int main() { char str[] = "mnbvcxzlkjhgfdsapoiuytrewq"; int size = strlen(str); int index = 0; for (int i = siz
阅读全文
摘要:#include <stdio.h> #include <string.h> int * getarr(int * ipt); int main() { int a = 99; char * ch ; int *p = getarr(&a); //gets(ch); printf("%d\n", *
阅读全文
摘要:#include <stdio.h> #include <string.h> #define MSG "woshishuya" int main() { char arr_str[] = MSG; char * pt_str = MSG; printf("1.数组的pointer:%p\n", ar
阅读全文
摘要:#include <stdio.h> void print_arr(int size,int arr[size]); int main() { int i_arr[10] = { 1, 2, 3, 4, 5, 6, 6, 8, 9, 10 }; print_arr(10,i_arr); //匿名数组
阅读全文
摘要:#include <stdio.h> void print_arr(int size,int arr[size]); int main() { int i_arr[10] = { 1, 2, 3, 4, 5, 6, 6, 8, 9, 10 }; print_arr(10,i_arr); return
阅读全文
摘要:#include <stdio.h> void print_arr(int (* pt)[2] ,int size); void print_pointer(int (* pt)[2] ,int size); int main() { int t_arr[4][2] = { { 1, 200 },
阅读全文
摘要:#include <stdio.h> int main() { int t_arr[4][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7,8 } }; int o_arr[4] = { 1, 2, 3, 4 }; //获取元素值 printf("数组表示法-[3][
阅读全文
摘要:#include <stdio.h> void getsum(int pt[],int size ); void getsum1(int * head,int * tail ); int main() { int i_arr[5] = { 1, 20, 3, 4, 5 }; int *pt; get
阅读全文
摘要:#include <stdio.h> unsigned int Loop_Fibonacci(unsigned int n); unsigned int Recu_Fibonacci(unsigned int n); int main() { //给定正整数n(项数),返回响应的斐波那契数值 //斐
阅读全文
摘要:#include <stdio.h> int to_binary(int a); int main() { //求一个整数(十进制)的二进制(循环语句版) int a = 1234; int result; int shang; int size; int re; int b = a; int c
阅读全文
摘要:#include <stdio.h> long fact(int a); //计算指定参数的阶乘 int main() { //用循环求a的阶乘(注意输入参数不要超过12,会超过long的范围) int a = 4; long resutl = 1; for (int i = 1; i <= a;
阅读全文