摘要: int *a,*b;*a=0;*b=0;一定要初始化,不然返回地址 阅读全文
posted @ 2015-09-15 20:38 Mr__sun 阅读(1241) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 int main() 3 { 4 using namespace std; 5 //int A=10; 6 //double B=6; 7 cout << sizeof(int) << endl; 8 cout << sizeo... 阅读全文
posted @ 2015-09-15 16:05 Mr__sun 阅读(544) 评论(0) 推荐(0) 编辑
摘要: int(*f)(int);为指向函数的指针变量的定义方法,其中f为指向函数的指针变量,第一个int为函数返回值类型,第二个int为函数的形参类型。 阅读全文
posted @ 2015-09-13 13:42 Mr__sun 阅读(551) 评论(0) 推荐(0) 编辑
摘要: 有以下程序#include main(){ int a=1,b=2,c=3,d=0;if (a==1 && b++==2)if (b!=2||c--!=3)printf("%d,%d,%d\n",a,b,c);else printf("%d,%d,%d\n",a,b,c);else printf("... 阅读全文
posted @ 2015-09-13 13:03 Mr__sun 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 有以下定义和语句struct workers{ int num; char name[20]; char c;struct{ int day; int month; int year;} s;};struct workers w,*pw;pw=&w;能给w中year成员赋1980的语句是先要得到内层... 阅读全文
posted @ 2015-09-13 12:40 Mr__sun 阅读(247) 评论(0) 推荐(0) 编辑
摘要: #include main(){ FILE *f;f=fopen("filea.txt","w");fprintf(f,"abc");fclose(f);}若文本文件filea.txt中原有内容为:hello,则运行以上程序后,文件filea.txt中的内容为abc内容为重新写入后的内容 阅读全文
posted @ 2015-09-13 12:24 Mr__sun 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 用还是用ls (hd0,X)/grub命令查看每个盘里面的内容,情况一 :如果你是在/boot/grub这个目录下找到的 grub rescue>root=(hd0,9) grub rescue>prefix=/boot/grub //grub路径设置 gru... 阅读全文
posted @ 2015-09-10 12:45 Mr__sun 阅读(1377) 评论(0) 推荐(0) 编辑
摘要: 对于特殊的字符串,我们对字符串进行特殊与非特殊两种,第一种字符串开头特殊字符提到末尾处理方法或者末尾字符串提到开头,总之先处理特殊的就OK了开头提到末尾处理:#include "stdio.h"#include"stdlib.h"#include "conio.h"void fun(char*a){... 阅读全文
posted @ 2015-09-05 13:59 Mr__sun 阅读(545) 评论(0) 推荐(0) 编辑
摘要: 对于方程求根主要的思想主要采取迭代的思想,通过条件判断,循环执行直到满足条件以后直接跳出循环输出下面以x-cos(x)=0;为例 采用do-while 循环,输出Root:#include "stdio.h"#include "math.h"#include "stdio.h"double fun(... 阅读全文
posted @ 2015-09-05 12:16 Mr__sun 阅读(188) 评论(0) 推荐(0) 编辑
摘要: malloc函数动态分配了一个整型的内存空间,让abc都指向刚申请的空间,所以只有最后一个赋值语句的值保留在了空间里#includemain(){int *a,*b,*c;a=b=c=(int *)malloc(sizeof(int));*a=1;*b=2;*c=3;a=b;printf("%d%d... 阅读全文
posted @ 2015-09-04 19:38 Mr__sun 阅读(258) 评论(0) 推荐(0) 编辑