最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

c 语言中星号什么意思,Objective

互联网 admin 41浏览 0评论

c 语言中星号什么意思,Objective

这是真的吗,星号总是意味着“嘿,那是一个指针!”

一个指针总是持有记忆地址?

(是的,我知道一个*用于数学运算的例外)

例如:

NSString* myString;

要么

SomeClass* thatClass;

要么

(*somePointerToAStruct).myStructComponent = 5;

我觉得在定义一个指向一个类的指针的变量时,我需要知道关于Asterirsk(*)的更多信息。

因为有时候我已经在声明一个参数中声明了Parameter变量是一个指针,而且还需要使用变量前面的星号才能访问该值。最近发生在我想以[myObj myMethod:& myStruct]的方式将结构体的指针传递给方法之后,我无法从该结构中访问组件值,即使我的方法声明已经表示存在参数(DemoStruct *)myVar,其实应该已经被称为指向该demo的指针,但我一直都在说:“人,编译器,听!IIISSS指针:”并写:(* myVar).myStructComponentX = 5 ;

我真的真的不明白为什么我不得不说两次。只有在这种情况下。

当我在NSString * myString的上下文中使用Asterisk时,我可以直接访问myString,但是我不用告诉编译器每次它是一个指针。即使用* myString = @“yep”。

这对我来说没有意义。

c 语言中星号什么意思,Objective

这是真的吗,星号总是意味着“嘿,那是一个指针!”

一个指针总是持有记忆地址?

(是的,我知道一个*用于数学运算的例外)

例如:

NSString* myString;

要么

SomeClass* thatClass;

要么

(*somePointerToAStruct).myStructComponent = 5;

我觉得在定义一个指向一个类的指针的变量时,我需要知道关于Asterirsk(*)的更多信息。

因为有时候我已经在声明一个参数中声明了Parameter变量是一个指针,而且还需要使用变量前面的星号才能访问该值。最近发生在我想以[myObj myMethod:& myStruct]的方式将结构体的指针传递给方法之后,我无法从该结构中访问组件值,即使我的方法声明已经表示存在参数(DemoStruct *)myVar,其实应该已经被称为指向该demo的指针,但我一直都在说:“人,编译器,听!IIISSS指针:”并写:(* myVar).myStructComponentX = 5 ;

我真的真的不明白为什么我不得不说两次。只有在这种情况下。

当我在NSString * myString的上下文中使用Asterisk时,我可以直接访问myString,但是我不用告诉编译器每次它是一个指针。即使用* myString = @“yep”。

这对我来说没有意义。

Error[2]: Trying to access array offset on value of type int, File: /www/wwwroot/www.usbmi.com/xiunophp/xiunophp.min.php, Line: 54
File: /www/wwwroot/www.usbmi.com/tmp/model_thread.func.php, Line: 1095, humandate(1735023775)
File: /www/wwwroot/www.usbmi.com/tmp/model_thread.func.php, Line: 662, well_thread_format(array(26))
File: /www/wwwroot/www.usbmi.com/tmp/view_template_d8_htm_read.htm, Line: 249, well_thread_find_asc(array(8) , 8)
File: /www/wwwroot/www.usbmi.com/tmp/route_read.php, Line: 204, include(/www/wwwroot/www.usbmi.com/tmp/view_template_d8_htm_read.htm)
File: /www/wwwroot/www.usbmi.com/tmp/index.inc.php, Line: 129, include(/www/wwwroot/www.usbmi.com/tmp/route_read.php)
File: /www/wwwroot/www.usbmi.com/index.php, Line: 29, include(/www/wwwroot/www.usbmi.com/tmp/index.inc.php)
Error[2]: Trying to access array offset on value of type int, File: /www/wwwroot/www.usbmi.com/xiunophp/xiunophp.min.php, Line: 54
File: /www/wwwroot/www.usbmi.com/tmp/model_thread.func.php, Line: 1096, humandate(1735023775)
File: /www/wwwroot/www.usbmi.com/tmp/model_thread.func.php, Line: 662, well_thread_format(array(27))
File: /www/wwwroot/www.usbmi.com/tmp/view_template_d8_htm_read.htm, Line: 249, well_thread_find_asc(array(8) , 8)
File: /www/wwwroot/www.usbmi.com/tmp/route_read.php, Line: 204, include(/www/wwwroot/www.usbmi.com/tmp/view_template_d8_htm_read.htm)
File: /www/wwwroot/www.usbmi.com/tmp/index.inc.php, Line: 129, include(/www/wwwroot/www.usbmi.com/tmp/route_read.php)
File: /www/wwwroot/www.usbmi.com/index.php, Line: 29, include(/www/wwwroot/www.usbmi.com/tmp/index.inc.php)
Error[2]: Trying to access array offset on value of type int, File: /www/wwwroot/www.usbmi.com/xiunophp/xiunophp.min.php, Line: 54
File: /www/wwwroot/www.usbmi.com/tmp/model_thread.func.php, Line: 1095, humandate(1735024187)
File: /www/wwwroot/www.usbmi.com/tmp/model_thread.func.php, Line: 662, well_thread_format(array(26))
File: /www/wwwroot/www.usbmi.com/tmp/view_template_d8_htm_read.htm, Line: 249, well_thread_find_asc(array(8) , 8)
File: /www/wwwroot/www.usbmi.com/tmp/route_read.php, Line: 204, include(/www/wwwroot/www.usbmi.com/tmp/view_template_d8_htm_read.htm)
File: /www/wwwroot/www.usbmi.com/tmp/index.inc.php, Line: 129, include(/www/wwwroot/www.usbmi.com/tmp/route_read.php)
File: /www/wwwroot/www.usbmi.com/index.php, Line: 29, include(/www/wwwroot/www.usbmi.com/tmp/index.inc.php)
Error[2]: Trying to access array offset on value of type int, File: /www/wwwroot/www.usbmi.com/xiunophp/xiunophp.min.php, Line: 54
File: /www/wwwroot/www.usbmi.com/tmp/model_thread.func.php, Line: 1096, humandate(1735024187)
File: /www/wwwroot/www.usbmi.com/tmp/model_thread.func.php, Line: 662, well_thread_format(array(27))
File: /www/wwwroot/www.usbmi.com/tmp/view_template_d8_htm_read.htm, Line: 249, well_thread_find_asc(array(8) , 8)
File: /www/wwwroot/www.usbmi.com/tmp/route_read.php, Line: 204, include(/www/wwwroot/www.usbmi.com/tmp/view_template_d8_htm_read.htm)
File: /www/wwwroot/www.usbmi.com/tmp/index.inc.php, Line: 129, include(/www/wwwroot/www.usbmi.com/tmp/route_read.php)
File: /www/wwwroot/www.usbmi.com/index.php, Line: 29, include(/www/wwwroot/www.usbmi.com/tmp/index.inc.php)
Error[2]: Trying to access array offset on value of type int, File: /www/wwwroot/www.usbmi.com/xiunophp/xiunophp.min.php, Line: 54
File: /www/wwwroot/www.usbmi.com/tmp/model_thread.func.php, Line: 1095, humandate(1741228785)
File: /www/wwwroot/www.usbmi.com/tmp/model_thread.func.php, Line: 662, well_thread_format(array(26))
File: /www/wwwroot/www.usbmi.com/tmp/view_template_d8_htm_read.htm, Line: 249, well_thread_find_asc(array(8) , 8)
File: /www/wwwroot/www.usbmi.com/tmp/route_read.php, Line: 204, include(/www/wwwroot/www.usbmi.com/tmp/view_template_d8_htm_read.htm)
File: /www/wwwroot/www.usbmi.com/tmp/index.inc.php, Line: 129, include(/www/wwwroot/www.usbmi.com/tmp/route_read.php)
File: /www/wwwroot/www.usbmi.com/index.php, Line: 29, include(/www/wwwroot/www.usbmi.com/tmp/index.inc.php)
Error[2]: Trying to access array offset on value of type int, File: /www/wwwroot/www.usbmi.com/xiunophp/xiunophp.min.php, Line: 54
File: /www/wwwroot/www.usbmi.com/tmp/model_thread.func.php, Line: 1096, humandate(1741228785)
File: /www/wwwroot/www.usbmi.com/tmp/model_thread.func.php, Line: 662, well_thread_format(array(27))
File: /www/wwwroot/www.usbmi.com/tmp/view_template_d8_htm_read.htm, Line: 249, well_thread_find_asc(array(8) , 8)
File: /www/wwwroot/www.usbmi.com/tmp/route_read.php, Line: 204, include(/www/wwwroot/www.usbmi.com/tmp/view_template_d8_htm_read.htm)
File: /www/wwwroot/www.usbmi.com/tmp/index.inc.php, Line: 129, include(/www/wwwroot/www.usbmi.com/tmp/route_read.php)
File: /www/wwwroot/www.usbmi.com/index.php, Line: 29, include(/www/wwwroot/www.usbmi.com/tmp/index.inc.php)
发布评论

评论列表 (0)

  1. 暂无评论