自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 收藏
  • 关注

转载 C语言中指针变量的初始化

a.赋值一个已有变量的地址 int a; int *p=&a; b.新开辟一块内存空间 int *p=(int*)malloc(size(int)); c.赋空值 int *p=NULL;

2013-05-11 19:18:16 581

原创 C语言 指针数组

#include "stdio.h" #include "stdlib.h" int main(){  char *ps[]={"abin","lee","varyall"};  printf("%s.\n",ps[0]);  printf("%s.\n",ps[1]);  printf("%s.\n",ps[2]);  printf("%s.\n",*(ps));  printf

2013-05-10 00:11:26 470

原创 C语言 字符串指针初始化

#include "stdio.h" #include "stdlib.h" int main(){  char *ps=(char*)malloc(sizeof(char)*3);  ps="abc";  free(ps);  printf("%s.\n",ps); }

2013-05-10 00:02:54 1986

原创 C语言结构体实例一

#include "stdio.h" #define LEN 20 struct info{ char first[LEN]; char last[LEN]; int age; }; int main(){ struct info boy={"abin" ,"lee" ,20}; printf("%s %s %d.\n",boy.first,boy.last,boy.age

2013-05-08 20:29:11 613

原创 C语言指针开辟内存释放内存

#include "stdio.h" #include "string.h" #include "stdlib.h" int main(){ char *a=NULL; char *b=NULL; a=(char*)malloc(100); b=(char*)malloc(100); a="abc"; b="abc"; int result=strcmp(a,b); prin

2013-05-08 00:18:02 937

原创 C++ 多线程实例一

#include #include using namespace std; DWORD WINAPI Fun(LPVOID IpParamter){  while(1){  cout  Sleep(1000); } } int main(int argc,char *argv[]){  HANDLE hThread=CreateThread(NULL,0,Fun,NULL

2013-04-23 23:58:40 426

转载 c语言不同源文件间函数的调用

yan335998206 | 分类:C/C++ | 浏览2236次 很多程序中,经常要用到延时函数 ,如下 void delay() {int i,j; for(i=0;i<255;i++) for(l=0;j<255;j++); } 每次用这函数都要写一遍,我就想把它单独写成一个源文件,以后直接调用。该怎么做啊,谢谢指教。 我有更好的答案 提问者采纳 200

2013-04-06 21:29:20 1204

原创 普通C++类的定义

#include using namespace std; class UnionStd{  public:  int GetAge();  void SetAge(int age);  void Call();  private:  int UnionStd::itAge; }; int UnionStd::GetAge(){  return itAge; } voi

2013-04-06 21:28:38 510

原创 C语言switch语句

#include "stdio.h" int main(int argc,char *argv[]) { printf("please input a number:\n"); int num; scanf("%d",&num); printf("\n"); while(1){ switch(num) { case 1: printf("you input num is:%d

2012-03-26 23:22:05 383

原创 C语言读文件(一)

#include "stdio.h" int main(int argc,char *argv[]) { FILE *fp; char ch; fp=fopen("one.txt","rt"); if(fp==NULL) { printf("can not one.txt\n"); getch(); exit(1); } printf("now i can read a

2012-03-26 22:17:24 363

原创 C语言写文件操作(一)

#include "stdio.h" int main(int argc,char *argv[]) { FILE *fp; char ch; fp=fopen("one.txt","wt+"); if(fp==NULL) { printf("can not this file"); getch(); exit(1); } printf("please input a

2012-03-26 22:03:46 257

原创 C语言 写文件操作

#include "stdio.h" int main(int argc,char *argv) { FILE *fp; char ch; if((fp=fopen("aaa.txt","wt+"))==NULL) { printf("Cannot open file!"); getch(); exit(1); } printf("input a string:\n")

2012-03-22 23:40:59 319

原创 C语言 指针连接字符串(二)

#include "stdio.h" int main(int argc,char * argv[]) {  char *connect(char *s1,char *s2);  char s1[80],s2[80];  gets(s1);  gets(s2);  puts(connect(s1,s2));  return 0; } char *connect(char *s1

2012-03-22 14:24:03 1075

原创 C语言连接字符串

#include "stdio.h" int main(int argc,char * argv[]) { char c[40]; char a[20]="ab"; char b[20]="cd"; strcpy(c,strcat(a,b)); printf("c=%s\n",c); // printf(strcat(a,b)); return 0; }

2012-03-22 13:10:28 458

原创 C语言 指针连接两个字符串(一)

#include "stdio.h" int main(int argc,char *argv[]) { char *mystr(char *s1,char *s2); char s1[80],s2[80]; gets(s1); gets(s2); puts(mystr(s1,s2)); return 0; } char *mystr(char *s1,char *s2

2012-03-22 11:15:48 1697

原创 C语言 strcat连接符

#include "stdio.h" int main(int argc,char *argv[]) { char buf[100]="i love"; char *tem="you !"; strcat(buf,tem); puts(buf); getchar(); return 0; }

2012-03-21 23:55:19 364

原创 C语言 头文件(.h)使用方法

//abing.h #include "stdio.h" int plus(int one,int two); char show(char a,char b); //plus.c #include "stdio.h" int plus(int one,int two) { int c=0; c=one+two; return c; } //s

2012-03-21 23:37:06 849

原创 C语言生成TXT文件

#include int main(int argc,char *argv[]) { FILE *fp; fp=fopen(argv[1],"w"); fputs("i love you",fp); fclose(fp); return 0; } Microsoft Windows [版本 6.1.7600] 版权所有 (c) 2009 Micro

2012-03-20 00:03:42 2999

原创 C语言

呵呵

2012-03-19 16:07:14 504

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除