ARM第一个项目中关于C的总结
1:每一个变量在使用前都得声明,不然在使用的时候就有可能是随机的数字
2:注意头文件中函数声明的时候要在后面加上分号
3:注意串口可以打印变量,就像C中的printf一样
4:DNW中不能打印float型数据
5:注意结构体指针数组 的使用和调用
6:
相关文档:
数字转字符串:
用C++的streanstream:
#include <sstream>
#Include <string>
string num2str(double i)
...{
stringstream ss;
ss<<i;
return ss.str();
......
1) 什么是预编译,何时需要预编译:总是使用不经常改动的大型代码体。
程序由多个模块组成,所有模块都使用一组标准的包含文件和相同的编译选项。在这种情况下,可以将所有包含文件预编译为一个预编译头。
2) char * const p;
char const * p
const char *p ......
32)
int main()
{
int x=3;
printf("%d",x);
return 1;
}
问函数既然不会被其它函数调用,为什么要返回1?
mian中,c标准认为0表示成功,非0表示错误。具体的值是某中具体出错信息
33) 要对绝对地址0x100000赋值,我们可以用(unsigned int*)0x100 ......
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <getopt.h>
#define MAX_READFILE 24
#define MAX_INPUTFILE 10240
char *file ;
void time_out(){
syslog(LOG_INFO,"read inp ......
刚从网上看到c和java混编的文章,就亟不可待的尝试了一下。呵呵,效果还是很好的。下面将自己成果粘贴出来
(转载于http://www.zxbc.cn/html/20070518/19986.html)。实验之后可以通过。
1java中调用c语言
首先编写Main.java
public class Main
{
public native static int getStrNum(byte str[], int s ......