delphi hello world 与c++不同的地方(1)
来源:互联网 发布:高斯 知乎 编辑:程序博客网 时间:2024/05/27 14:12
======================================================
注:本文源代码点此下载
======================================================
code
program helloworld;
{$apptype console}
begin
writeln('hello world');
end.
1,delphi有过程与函数之分,函数有返回值.
delphi的参数默认是传值,如果要传址则加上var,如
code
function myfun(thisisnotptr : integer ; var thisisptr: integer);
各参数间用分号,非逗号隔开.
2,delphi的string
delphi的string分三种:
一,是常量型string,通常表示为str : pchar = 'blah';此类string等同与c/c++中的字符串.
二,为一字符数组,比如str : string[32];此字符数组的下标从1..32共32 ,因为str[0]存放的是字符的长度,所以整个字符串的长度
为33.这也就是为什么在申明如str2 : string[256];时为出错的原因.
三,ansistring,简单的说是,分配在堆中的字符串,用户不需要维护内存,此字符串前8字节作为功能区:其中前4字节是此字符串的长度,后4
字节是此字符串的引用数,引用数为0时,此内存区由系统回收.英文原文如下:
a long-string variable is a pointer occupying four bytes of memory. when the
variable is empty—that is, when it contains a zero-length string—the pointer is nil
and the string uses no additional storage. when the variable is nonempty, it points a
dynamically allocated block of memory that contains the string value. the eight
bytes before the location contain a 32-bit length indicator and a 32-bit reference
count. this memory is allocated on the heap, but its management is entirely
automatic and requires no user code.
3,数组
delphi的数组下标可以自定,用如下形式声明:
code
var
oneline : array[1..10] of char;//one dimension
matrix : array[0..3,0..3] of integer;//two dimension
======================================================
在最后,我邀请大家参加新浪APP,就是新浪免费送大家的一个空间,支持PHP+MySql,免费二级域名,免费域名绑定 这个是我邀请的地址,您通过这个链接注册即为我的好友,并获赠云豆500个,价值5元哦!短网址是http://t.cn/SXOiLh我创建的小站每天访客已经达到2000+了,每天挂广告赚50+元哦,呵呵,饭钱不愁了,\(^o^)/
- delphi hello world 与c++不同的地方(1)
- java与c/c++不同的地方
- C++(1) Hello world!
- QT1.1-与Opencv的hello world
- QT1.1-与Opencv的hello world
- 不同编程语言写的“Hello World”
- C基础(1)/hello world
- C--开始C的旅程--"hello world!"
- [Erlang]hello world”与<<”hello world”>>详解(1)
- 编译Native C的hello,world模块
- MPI + C 的hello world程序
- 最小的C语言Hello,world程序
- 您的第一个Delphi程序(Hello World)
- 我的第一个Delphi程序(Hello World)
- 1、JMX的Hello World
- 使用C#编写不同的"Hello World"程序(转)
- 在不同的环境中编译hello world程序
- Linux C再次从零开始(1)--hello world
- delphi中exit,abort,break,continue 的区别
- 当Google忙着忽悠Android的时候,各位别忘了还有Html5!
- IIS Form 认证 保护HTML页面
- 发布一个简单小巧的ajax操作类
- delphi连接数据库
- delphi hello world 与c++不同的地方(1)
- N个富文本编辑器/基于Web的HTML编辑器
- delphi下实现ribbon界面的方法(一)
- Delphi调用CreateProcess创建线程
- Dufe王彬
- 关于ajax应用中session过期问题的几个解决方案
- java 异常抛出
- 导出HTML的Table到Excel中
- asp.net 自定义错误页