
C语言
文章平均质量分 58
iteye_9920
这个作者很懒,什么都没留下…
展开
-
I/O操作
输出信息到文件中 #include<stdio.h>void main(){ FILE *p; char ch='c'; p=fopen("1.txt","w+"); fputc(ch,p);} 从文件读取到程序中 #include<stdio.h>void main(){ FILE ...2011-09-18 22:49:02 · 94 阅读 · 0 评论 -
结构体
#include<stdio.h>struct student{char name[10];int number;} std,*p;void main(){ std.name[0]='c'; std.number=10; p->name[0]='n'; p->number=100; printf("%c,%d\n",...2011-09-18 22:58:04 · 86 阅读 · 0 评论 -
指向函数的指针
#include<stdio.h>int (*p)(int,int);int max(int a,int b);void main(){ int a,b,c; a=1;b=2; p=max; c=(*p)(a,b); printf("%d",c);}int max(int a,int b){ ...2011-09-18 23:04:49 · 65 阅读 · 0 评论 -
套接字
#include<stdio.h>#include<Winsock2.h>void main(){ WORD wVersionRequested;WSADATA wsaData;int err; wVersionRequested = MAKEWORD( 2, 2 ); err = WSAStartup( wVersionReq...2011-09-18 23:24:11 · 102 阅读 · 0 评论 -
C语言中复制文件
#include<stdio.h>int main(){ FILE *dest_p,*source_p; int ch; source_p=fopen("1.tar.gz","rb"); dest_p=fopen("2.tar.gz","wb"); while((ch=getc(source_p))!=EOF) { putc(ch,de...2011-09-26 00:07:38 · 314 阅读 · 0 评论 -
C语言中malloc和Free的使用
malloc分配内存,free释放内存,结构体中的指针和结构体指针要通过malloc分配,使用完后,通过free释放并置于NULL, #include<iostream>using namespace std;typedef struct _Birthday{ int day; int month; int year;} Birthday;...原创 2012-12-30 12:56:29 · 214 阅读 · 0 评论