avatar
C*U
2
这两日在温习86版的红楼,31、32集,感触良多,一言难尽。。。
avatar
h*a
3
USA的,很好看.
==以下介绍转载自天涯小筑 转载请注明出处==
USA秋季新剧《不是冤家不聚头》(White Collar)10月23日首播。这是一部相当有意思的剧集(USA最近几部新剧的品质都非常不错)--虽然类型上依然是美国人最喜爱的「罪案调查」,但形式上又有新的「花样」。故事讲述两个男人联手侦破FBI顶级要案,抓获最狡诈的罪犯的故事。这两个人一个是诈骗高手,另一个是专门捉拿诈骗高手的FBI 警探。他们本来没有合作的可能,但事实证明他们合作得很好--除了经常因意见相左而争吵之外。
Neal Caffrey(Matt Bomer扮演,"Chuck","Tru Calling")是一位英俊帅气但是臭名昭著的诈骗犯,最近刚刚从安全等级最高的联邦监狱中成功逃脱。Peter Burke(Tim DeKay扮演,"Tel l Me You Love Me")是一位出色的FBI警探,Neal的死敌。Peter将Neal抓住,然后又故意让他脱逃,自然有他的打算。Elizabeth Burke(Tiffani Thiessen扮演,"What About Brian","Fastlane")是P
avatar
c*9
4
I have a c++ function with this signature void f(char ** input)
char a[10] = "":
strcpy( a, anotherstring.c_str());
f( &a );
The compiler complain about can not convert the type for function f
parameter.
any ideas what is wrong?
thanks,
avatar
A*e
5
我文盲看到红楼梦就打瞌睡。。

【在 C*****U 的大作中提到】
: 这两日在温习86版的红楼,31、32集,感触良多,一言难尽。。。
avatar
t*g
6
男的太英俊了, 有点太太英俊了, 呵呵, 女生会喜欢看的
avatar
X*r
7
'&a' is of type 'char (*)[10]', not of type 'char **'.

【在 c*******9 的大作中提到】
: I have a c++ function with this signature void f(char ** input)
: char a[10] = "":
: strcpy( a, anotherstring.c_str());
: f( &a );
: The compiler complain about can not convert the type for function f
: parameter.
: any ideas what is wrong?
: thanks,

avatar
C*U
8
你也太薄情郎了。
我看一次震撼一次,几个场景我经常都会落泪。。。
那样的演员,那样的眼神,那样的音乐,怎么会打瞌睡?

【在 A*****e 的大作中提到】
: 我文盲看到红楼梦就打瞌睡。。
avatar
l*n
9
好看,我一直在追着呢
avatar
c*9
10
I think a is name of an array of char, so a is pointer to the a[0], which
should be of type char*, is that correct?
if so &a should be of type char** ?
thanks...
avatar
t*u
11
凯蒂也不错

【在 t******g 的大作中提到】
: 男的太英俊了, 有点太太英俊了, 呵呵, 女生会喜欢看的
avatar
X*r
12
No, this understanding is wrong.
If you declare 'char a[10];', 'a' has type 'char [10]', and '&a' has
type 'char (*)[10]'.
If you declare 'char *b;', 'b' has type 'char *', and '&b' has type
'char **'.
Type 'char []' can be implicitly converted into type 'char *', so 'a'
can be used in almost everywhere 'char *' is required. However,
'char (*)[]' cannot be converted to 'char **', so your code won't work.

which

【在 c*******9 的大作中提到】
: I think a is name of an array of char, so a is pointer to the a[0], which
: should be of type char*, is that correct?
: if so &a should be of type char** ?
: thanks...

avatar
s*n
13
我讨厌这个主线,没劲

【在 t***u 的大作中提到】
: 凯蒂也不错
avatar
X*r
14
What I just said is on the syntactic level.
On the semantic level, a is an array -- it contains all its elements.
It is not the same as a pointer to its first element. The latter is
'&a[0]'. For example, sizeof(a) is 10, which is the length of the array
times size of its individual element; while sizeof(&a[0]) is 4 on
32-bit architecture, which is the size of a 'char *' pointer.
Back to your problem: 'f' requires a 'char ** input'. Now assuming
you could just pass '&a' in. What would happen if f

【在 c*******9 的大作中提到】
: I think a is name of an array of char, so a is pointer to the a[0], which
: should be of type char*, is that correct?
: if so &a should be of type char** ?
: thanks...

avatar
t*g
15
不是我的茶
hehe

【在 t***u 的大作中提到】
: 凯蒂也不错
avatar
c*9
16
Thank you Xentar...
is the following OK and safe, is strcpy potentially wiping out existing data
(the memory after a)?
char* a:
strcpy( a, anotherstring.c_str());
f( &a );
all I want to do here is to pass a char** that point to a copy of value
anotherstring.c_str()...
what is the best way to do it?
Thanks again.
avatar
c*4
17
恩,真得好看。两个男一号都不错,不同的类型。
两人之间那种若有若无的信任让人感觉很窝心。
我这个礼拜疯狂的追着。
是只出到第一季马?
avatar
X*r
18
No, that's wrong, either, because you didn't allocate memory
for a.
What you want to do could be the following:
char a[10], *b = a;
strcpy(a, anotherstring.c_str());
f(&b);
I didn't reply with the solution immediately because I wanted you
to understand the issue.
Another unrelated reminder is that strcpy is inherently dangerous.
Unless you're 100% sure the length of anotherstring is no greater
than 9, your code is not safe. Use strncpy instead.

existing data
value

【在 c*******9 的大作中提到】
: Thank you Xentar...
: is the following OK and safe, is strcpy potentially wiping out existing data
: (the memory after a)?
: char* a:
: strcpy( a, anotherstring.c_str());
: f( &a );
: all I want to do here is to pass a char** that point to a copy of value
: anotherstring.c_str()...
: what is the best way to do it?
: Thanks again.

avatar
d*g
19
看了几集,老觉得年轻男主角装模作样的很假。。。可能不是我的茶
avatar
c*9
20
Thanks Xenta...
will the following work also?
char a[10]:
strcpy( a, anotherstring.c_str());
f( &(&a[0]) );
avatar
h*a
21


【在 c*********4 的大作中提到】
: 恩,真得好看。两个男一号都不错,不同的类型。
: 两人之间那种若有若无的信任让人感觉很窝心。
: 我这个礼拜疯狂的追着。
: 是只出到第一季马?

avatar
p*o
22
Get a C book. You won't learn C from BBS.
BTW, the function f(char **p) looks quite suspicious.
It sounds to me it want to do some tricky things like
freeing *p following by allocating another buffer and
passing it outside, pretty much realloc. It will get
into serious problem if you pass in an array in this
case.

【在 c*******9 的大作中提到】
: Thanks Xenta...
: will the following work also?
: char a[10]:
: strcpy( a, anotherstring.c_str());
: f( &(&a[0]) );

avatar
r*x
23
Did anyone see last night's season finale? It seemed pretty obvious Kate
didn't stay on that plane
avatar
X*r
24
No. &a[0] is not a lvalue itself, so you cannot take its address.

【在 c*******9 的大作中提到】
: Thanks Xenta...
: will the following work also?
: char a[10]:
: strcpy( a, anotherstring.c_str());
: f( &(&a[0]) );

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。