- 浏览: 70306 次
- 性别:
- 来自: 大连
最近访客 更多访客>>
最新评论
-
newlangwen1:
你好 我想请教个问题,我运行了一下上面的程序,结果是输入什么就 ...
C程序 对文本行进行排序
文章列表
http://tech.ccidnet.com/art/738/20100716/2118509_1.html
Linux目录结构是和windows有大不同的设计,这很容易让初学者搞不明白,这里是个人总结的一些知识点,讲解Linux目录结构包括文件类型和一些重要的文件子目录。
linux文件系统的最顶端是/,称为linux的root,所有的目录、文件、设备都在/之下。
文件类型
linux有四种基本文件系统类型:普通文件、目录文件、连续文件和特殊文件。可以用file命令来识别。
普通文件:如文本文件、c语言源代码、shell脚本等,可以用cat、less ...
1. 不要在/usr/local/arm/目录下解压缩cross-3.4.1.tar.bz2
如果在 /usr/local/arm/目录下解压缩,那么解压缩后的路径会是/usr/local/arm/usr/local/arm/3.4.1/
2.安装好后 要在/etc/bashrc 文件最后一行,添加环境变量 PATH
3. 修改环境变量后,arm-linux-gcc后 还是 command not found
这是权限的问题 su一下 就好了(或者重启 再su ??)
http://baike.baidu.com/view/1223454.htm?fr=ala0_1
在专用的嵌入式板子运行GNU/Linux系统已经变得越来越流行。一个嵌入式Linux系统从软件的角度看通常可以分为四个层次:
1、 引导加载程序。包括固化在固件(firmware)中的boot代码(可选) ...
http://ninayang1987.blog.sohu.com/135196709.html
下面把步骤贴出来,以供分享。
1. 利用VMware工具中的共享文件夹功能实现文件供享;
1) 启动PC中的VMware;
2) 在VMware窗口中选择“虚拟机(M)”下拉菜单;在菜单中选择“按装VMware工具(V)”;
3) 开启一个终端窗口,准备键入命令;
4) #ls /mnt/cdrom/——可以看到VMware工具包;
http://zhidao.baidu.com/question/144340465.html?fr=ala0
如果是指变量的声明和定义:从编译原理上来说,声明是仅仅告诉编译器,有个某类型的变量会被使用,但是编译器并不会为它分配任何内存。而定义就是分配了内存。对于下面的两句代码:void Func(){int a;int b=0;a=0;}对于第一行代码,编译器不会做任何事,它不会为它在栈中分配一点东西,直到第三句,a=0;时,编译器才会将其压入栈中。而对于int b=0;这一句,编译器就会生成一条指令,为它赋值。如果反汇编,看到的代码可能是这样的:push 1; push ...
指针函数是返回指针的函数,即本质是一个函数。函数返回类型是某一类型的指针
例如:int *f(x,y);
函数指针是指向函数的指针变量,即本质是一个指针变量。
例如:
int (*f) (int x); /* 声明一个函数指针 */
f=func; /* 将func函数的首地址赋给指针f */
分析复杂的声明:
char (*a[3])(int);
从最里层开始分析
a是一个长度为3的数组,数组的每一个元素是指针,即a[3]是指针,*a[3]即a[3] 所指向的内容,那么*a[3] 是什么呢,*a[3]后面有小括号,所以*a[3]是函数,该函数的 ...
echo.cpp
#include <stdio.h>
/* echo command-line arguments; 1st version */
main(int argc, char *argv[])
{
int i;
for (i = 1; i < argc; i++)
printf("%s%s", argv[i], (i < argc-1) ? " " : "");
printf("\n");
return 0;
}
Debug 目 ...
#include <stdio.h>
int main(){
int i = 2;
int j=~i;
printf("%d\n",j);
return 0;
}
// 输出结果为-3
在计算机里数据以补码的形式存放,2的源码是 0010,其补码是0010,取反后为1101,输出时,计算机认为1101是一个负数,因此,既是一个求补码的原码的过程。一个数的补码是1101,可以求得它的原码为1011,即是-3
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAXLINES 5000 /* max #lines to be sorted */
char *lineptr[MAXLINES]; /* pointers to text lines */
int readlines(char *lineptr[], int nlines);
void writelines(char *lineptr[], int nlines);
void qsort( ...
C语言跟内存分配方式
(1) 从静态存储区域分配。内存在程序编译的时候就已经分配好,这块内存在程序的整个运行期间都存在。例如全局变量,static变量。
(2) 在栈上创建。在执行函数时,函数内局部变量的存储单元都 ...
strend(s,t) 如果字符串t出现在字符串s的尾部,该函数返回0,否则返回1
#include<stdio.h>
int strend(char *s,char *t);
int main(){
char *s="hewawowa";
char *t="wo";
int cmp=strend(s,t);
printf("%d\n",cmp);
return 0;
}
int strend(char *s, char *t)
{
char *ss = ...
#include<stdio.h>
void strcat(char *s, char *t);
void strcpy(char *s,char *t);
int main(){
char s[100] = "hello";
char *d = "world";
strcat(s,d);
printf("%s\n",s);
return 0;
}
void strcpy(char *s,char *t)
{
while(*s++ = *t++)
;
...
#include<stdio.h>
void strcpy(char *s,char *t);
int main(){
char *s = new char[100];
s = "hello";
//char s[100] = "hello";
char *d = "world";
strcpy(s,d);
printf("%s\n",s);
return 0;
}
void strcpy(char *s,char *t)
{
...
#include <ctype.h>
#include <stdio.h>
#define BUFSIZE 100
char buf[BUFSIZE]; /* buffer for ungetch */
int bufp = 0; /* next free position in buf */
int getch(void);
void ungetch(int);
/* getint: get next integer from input into *pn */
double getdou(double * ...
定义宏swap(t, x, y)以交换t类型的两个参数
#include<stdio.h>
#define swap(t,x,y) do{t z=x;x=y;y=z;}while(0)
int main(void) {
int ix, iy;
double dx, dy;
char *px, *py;
ix = 42;
iy = 69;
printf("integers before swap: %d and %d\n", ix, iy);
swap(int, ix, iy);
prin ...