Return via Address

 Pascal Code 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 
unit  XingshiCanshu;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm5 = 
class (TForm)
    lbl1: TLabel;
    edt1: TEdit;
    lbl2: TLabel;
    edt2: TEdit;
    lbl3: TLabel;
    edt3: TEdit;
    btn1: TButton;
    
procedure  btn1Click(Sender: TObject);
  
private
    
{ Private declarations }
    
procedure  ChangeValue ( var  i:  Integer var  j :  Integer );      //参数使用变量参数
   public
    
{ Public declarations }
  
end ;

var
  Form5: TForm5;

implementation

{$R *.dfm}

procedure  TForm5.btn1Click(Sender: TObject);
var
x  : 
integer ;
y : 
Integer ;
begin
x :=StrToInt( edt1.
Text );
y := StrToInt(edt2.
Text );
ChangeValue(x, y);      
//调用函数之后,x和y的值会被修改
edt3. Text  := IntToStr(x + y) ;

end ;

procedure  TForm5.ChangeValue( var  i :  Integer var  j: Integer );   //  形参使用变量参数,按地址传递
begin
  i := i + 
10 ;
  j := j + 
15 ;
end ;



end .

转载于:https://www.cnblogs.com/kivin/p/4646957.html

#include <stdio.h> #include <string.h> #include <libwebsockets.h> #define BUFFER_SIZE 4096 static struct lws *wsi_client = NULL; static int callback_chat(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len) { switch (reason) { case LWS_CALLBACK_CLIENT_ESTABLISHED: // 连接建立,记录wsi_client wsi_client = wsi; break; case LWS_CALLBACK_CLIENT_RECEIVE: // 接收到服务端发来的消息,输出到控制台 printf("[Client] Message received: %s\n", (char *)in); break; case LWS_CALLBACK_CLIENT_CLOSED: // 连接关闭,设置wsi_client为NULL wsi_client = NULL; break; default: break; } return 0; } static struct lws_protocols protocols[] = { { "chat", callback_chat, 0, BUFFER_SIZE }, { NULL, NULL, 0, 0 } }; int main(int argc, char **argv) { struct lws_context_creation_info info; memset(&info, 0, sizeof(info)); info.port = CONTEXT_PORT_NO_LISTEN; info.protocols = protocols; info.gid = -1; info.uid = -1; struct lws_context *context = lws_create_context(&info); if (context == NULL) { fprintf(stderr, "Error: Failed to create libwebsocket context\n"); return -1; } struct lws_client_connect_info connect_info; memset(&connect_info, 0, sizeof(connect_info)); connect_info.context = context; connect_info.address = "localhost"; connect_info.port = 8080; connect_info.path = "/"; connect_info.host = lws_canonical_hostname(context); connect_info.origin = connect_info.host; connect_info.protocol = protocols[0].name; struct lws *wsi = lws_client_connect_via_info(&connect_info); if (wsi == NULL) { fprintf(stderr, "Error: Failed to connect to server\n"); lws_context_destroy(context); return -1; } while (wsi_client == NULL) { lws_service(context, 50); } char buffer[BUFFER_SIZE]; while (fgets(buffer, BUFFER_SIZE, stdin)) { if (wsi_client == NULL) { break; } buffer[strlen(buffer) - 1] = '\0'; lws_write(wsi_client, (unsigned char *)buffer, strlen(buffer), LWS_WRITE_TEXT); } lws_context_destroy(context); return 0; }这段代码是否有问题?
06-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值