终于解决了,我说程序怎么一直崩溃呢
2013年09月13日
⁄ 综合
⁄ 共 666字 ⁄ 字号
小 中 大
- #include <stdio.h>
- #include <conio.h>
- #include <stdlib.h>
- #include <time.h>
- int main ()
- {
- char ch[80];
- time_t tn,*p;
-
- time(p);
-
- tn=time(0);
-
- printf("%ld/n%ld/n",tn,*p);
- struct tm *pt;
- pt=localtime(&tn);
-
- printf("%s", asctime(pt));
- printf("%s",ctime(&tn));
- printf("%s",ctime(p));
-
- tn=time(0);
- pt=localtime(&tn);
- strftime(ch,80,"This is week %U of the year %Y",pt);
- puts(ch);
- getch();
- return 0;
- }
-
-
- 我擦,一直都没注意指针的问题,知道这次因为程序一直崩溃,才注意了,我说怎么加上char ch[80];程序就会崩溃阿。。。还以为是char ch[80];有问题,果然,错的是我,不是电脑。。。。。