工具VC++.6.0.with.SP6+VisualAssist
[b]第一个程序[/b] 使用goto,注意lebel后面需要有语句,没有不行
int getc(FILE *stream);
int getche(Void);
[b]第二个程序[/b],
不要用scanf读一个整行,他只读到第一个空格处
可以用gets读一个整行
int atoi(const char *string);字符串转换成整形
int toupper(int c)小写字母转换成大写字母
putchar('H')
puts(STRING);
goto
break
continue
exit(status) 先执行atexit()登记的函数,后进先出的顺序
abort()
spawn()系列,比exec多接受一个参数(mode)模式参数
exec()系列
system(const char * command);
c的类型:
object type,function type incomplate type
[b]指针[/b]
cpu寻址寄存器:
register int i;
[b]动态内存[/b]
1.决定需要多少内存
2.分配内存;
3.存储(或使用)内存空间的指针;
4.用完后释放内存;
void *calloc(size_t nmemeb,size_t size);对象数目,何种类型
可以参见unix高级编程的源码fig14.18,
void *malloc(size_t size);定容量的内存,参见fig11.10
void *realoc(void *block,size_t size);重新定义内存块大小
void free(void *block);
[b]第一个程序[/b] 使用goto,注意lebel后面需要有语句,没有不行
#include "stdafx.h"
int i;
int main(int argc, char* argv[])
{
char name[30];
printf("Hello World!\n");
puts("hello");
for(i=0;i<10;i++){
if(i==5) goto label1;
printf("in the for loop i=%d\n",i);//不打印5
label1:
{
scanf("%s",name);
printf("%s\n",name);
}
}
return 0;
}
int getc(FILE *stream);
int getche(Void);
[b]第二个程序[/b],
#include "stdafx.h"
int main(int argc, char* argv[])
{
int char_in;
char_in=getc(stdin);
printf("%d",char_in);
return 0;
}
不要用scanf读一个整行,他只读到第一个空格处
可以用gets读一个整行
int atoi(const char *string);字符串转换成整形
int toupper(int c)小写字母转换成大写字母
putchar('H')
puts(STRING);
goto
break
continue
exit(status) 先执行atexit()登记的函数,后进先出的顺序
abort()
spawn()系列,比exec多接受一个参数(mode)模式参数
exec()系列
system(const char * command);
c的类型:
object type,function type incomplate type
[b]指针[/b]
#include "stdafx.h"
int main(int argc, char* argv[])
{
int i,j;
int * i_ptr;
i=34;
i_ptr=&i;
j=*i_ptr;
printf("i=%d\n",i);//34
printf("j=%d\n",j);//34
printf("i_ptr=%p\n",i_ptr);//0012FF7C
return 0;
}
cpu寻址寄存器:
register int i;
[b]动态内存[/b]
1.决定需要多少内存
2.分配内存;
3.存储(或使用)内存空间的指针;
4.用完后释放内存;
void *calloc(size_t nmemeb,size_t size);对象数目,何种类型
可以参见unix高级编程的源码fig14.18,
void *malloc(size_t size);定容量的内存,参见fig11.10
void *realoc(void *block,size_t size);重新定义内存块大小
void free(void *block);