473,513 Members | 2,881 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

char string

When we write

char *p = "xyz" ;

Many books state that compiler stores "xyz" in memory and returns
pointer to that memory
which is assigned to p . My question is , in what type of memory ,
heap or stack ?

Regards
Mangesh .

Apr 9 '06 #1
25 1885
I think stack, since xyz is a constant statically allocated.

Apr 9 '06 #2

akiross wrote:
I think stack, since xyz is a constant statically allocated.


I don't know what the standard says, but wouldn't it depend on where
the statement was made? If it were global, wouldn't the memory be
allocated before the program started running? In that case, I don't
think it could be on the stack. It might be in an initialization
section.

Apr 9 '06 #3
On 2006-04-09, akiross <ak**********@gmail.com> wrote:
I think stack, since xyz is a constant statically allocated.


He hasnt specified *where* he has done this declaration so you cant
state whether it is static/heap or not : to be more specific if he is
writing this line in a function as opposed to "global declarations"
outside of any function definitions then this is one thing, inside
functions is another. Inside functions, without the static keyword
then it is a stack based allocation and you cant access it reliably at
function return. Inside functions with "static" it is probably heap and
fine to return a pointer to the data for access by calling functions.

What does the standard say about this?

Apr 9 '06 #4
mangesh wrote:
When we write

char *p = "xyz" ;

Many books state that compiler stores "xyz" in memory and returns
pointer to that memory
which is assigned to p . My question is , in what type of memory ,
heap or stack ?


Neither. It can be passed out to higher scopes, even after the scope
of p ends (so its not on the stack unless its in a scope as high as
main().) You cannot reliably call free on it, or any containing memory
object, meaning its not in the heap.

The memory exists statically. That is, it occupies the same sort of
memory as globals do though the scope may differ. In the real world,
this is usually put into a memory segment called the init segment which
is similar to the data segment, but may have other attributes, such as
being "read-only".

--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

Apr 9 '06 #5
Richard G. Riley wrote:

On 2006-04-09, akiross <ak**********@gmail.com> wrote:
I think stack, since xyz is a constant statically allocated.


He hasnt specified *where* he has done this declaration so you cant
state whether it is static/heap or not : to be more specific if he is
writing this line in a function as opposed to "global declarations"
outside of any function definitions then this is one thing, inside
functions is another. Inside functions, without the static keyword
then it is a stack based allocation and you cant access it reliably at
function return.
Inside functions with "static" it is probably heap and
fine to return a pointer to the data for access by calling functions.

What does the standard say about this?


It says that you're clueless on this matter.

"The stack" and "the heap"
are not concerns of the C programming language.
An object refered to by a string literal such as "xyz",
has static duration,
regardless of whether it's inside or outside of a function.
Objects with static duration
are initialised before main starts to execute.

--
pete
Apr 9 '06 #6
On 9 Apr 2006 09:43:40 -0700, we******@gmail.com wrote:
mangesh wrote:
When we write

char *p = "xyz" ;

Many books state that compiler stores "xyz" in memory and returns
pointer to that memory
which is assigned to p . My question is , in what type of memory ,
heap or stack ?


Neither. It can be passed out to higher scopes, even after the scope
of p ends (so its not on the stack unless its in a scope as high as
main().) You cannot reliably call free on it, or any containing memory
object, meaning its not in the heap.

The memory exists statically. That is, it occupies the same sort of
memory as globals do though the scope may differ. In the real world,
this is usually put into a memory segment called the init segment which
is similar to the data segment, but may have other attributes, such as
being "read-only".


Which is why these things are usually declared and passed around as
"const char*". Bear that in mind, original poster.
Apr 9 '06 #7

mangesh wrote:
When we write

char *p = "xyz" ;

Many books state that compiler stores "xyz" in memory and returns
pointer to that memory
which is assigned to p . My question is , in what type of memory ,
heap or stack ?

Regards
Mangesh .


I was wondering if the standard actually talks of stack or heap. I
guess not. But again I am playing a guessing game.

I would rather say that the memory is statically linked so you can
access the data even after you have exited the function.

Oh, btw what should my reply be to an interviewer who asks this
question ? I tried reasoning with him (and thats not in one interview
but many) in most polite terms (AFAIK) with above statements but he
would not listen. Please let me know what my response be.

Apr 10 '06 #8
"Jaspreet" <js***********@gmail.com> writes:
mangesh wrote:
When we write

char *p = "xyz" ;

Many books state that compiler stores "xyz" in memory and returns
pointer to that memory
which is assigned to p . My question is , in what type of memory ,
heap or stack ?

Regards
Mangesh .
I was wondering if the standard actually talks of stack or heap. I
guess not. But again I am playing a guessing game.


It doesn't.
I would rather say that the memory is statically linked so you can
access the data even after you have exited the function.
I'd say statically allocated, not statically linked.
Oh, btw what should my reply be to an interviewer who asks this
question ? I tried reasoning with him (and thats not in one interview
but many) in most polite terms (AFAIK) with above statements but he
would not listen. Please let me know what my response be.


Storage duration is described in C99 6.2.4.

Many C implementations do use a "stack" (for objects with "automatic
storage duration" and other per-call data) and a "heap" (for objects
with "allocated storage duration"). It's unlikely that such an
implementation would use either stack or heap for string literals.

This probably isn't the best place to ask about interview strategies.
Personally, if I know I'm right about something during a job
interview, I'm not going to back down because the interviewer thinks
he's smarter than I am. (And it's always possible the interviewer is
deliberately testing me.) But I take absolutely no responsibility for
the consequences of treating this observation as advice.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Apr 10 '06 #9
Jaspreet wrote:
mangesh wrote:
When we write

char *p = "xyz" ;

Many books state that compiler stores "xyz" in memory and returns
pointer to that memory
which is assigned to p . My question is , in what type of memory ,
heap or stack ?

Regards
Mangesh .


I was wondering if the standard actually talks of stack or heap. I
guess not. But again I am playing a guessing game.

I would rather say that the memory is statically linked so you can
access the data even after you have exited the function.

Oh, btw what should my reply be to an interviewer who asks this
question ? I tried reasoning with him (and thats not in one interview
but many) in most polite terms (AFAIK) with above statements but he
would not listen. Please let me know what my response be.


If you need the job then say its on the stack because you cannot call
free() on it, or any containing object. Then if you get the job
compile the source yourrself, decompile it, then show him that it is in
the init segment. Then point him to documentation about how your OS
loads segments into memory, and that segments are not part of any
"stack".

If you don't need the job that badly, or you reject the job for the
content of this question (and possibly others) then tell him to compile
it up for himself, trace it with a debugger and he will see that it is
neither on the stack, nor in the heap (the address ranges will almost
surely not match up -- and on a standard x86 you will *know* its not on
the stack because its not using stack instructions to access it). If
the interviewer is using the latest MS Visual studio, tell him to try
to execute p[0] = 'x', and ask him which of the heap or the stack he
thinks can contain read-only memory.

--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

Apr 11 '06 #10
Jaspreet wrote:
mangesh wrote:
When we write

char *p = "xyz" ;

Many books state that compiler stores "xyz" in memory and returns
pointer to that memory
which is assigned to p . My question is , in what type of memory ,
heap or stack ?

Regards
Mangesh .


I was wondering if the standard actually talks of stack or heap. I
guess not. But again I am playing a guessing game.

I would rather say that the memory is statically linked so you can
access the data even after you have exited the function.

Oh, btw what should my reply be to an interviewer who asks this
question ? I tried reasoning with him (and thats not in one interview
but many) in most polite terms (AFAIK) with above statements but he
would not listen. Please let me know what my response be.


If you need the job then say its on the stack because you cannot call
free() on it, or any containing object. Then if you get the job
compile the source yourrself, decompile it, then show him that it is in
the init segment. Then point him to documentation about how your OS
loads segments into memory, and that segments are not part of any
"stack".

If you don't need the job that badly, or you reject the job for the
content of this question (and possibly others) then tell him to compile
it up for himself, trace it with a debugger and he will see that it is
neither on the stack, nor in the heap (the address ranges will almost
surely not match up -- and on a standard x86 you will *know* its not on
the stack because its not using stack instructions to access it). If
the interviewer is using the latest MS Visual studio, tell him to try
to execute p[0] = 'x', and ask him which of the heap or the stack he
thinks can contain read-only memory.

--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

Apr 11 '06 #11
Jaspreet wrote:

mangesh wrote:
When we write

char *p = "xyz" ;

Many books state that compiler stores "xyz" in memory and returns
pointer to that memory
which is assigned to p . My question is , in what type of memory ,
heap or stack ?

Regards
Mangesh .


I was wondering if the standard actually talks of stack or heap. I
guess not. But again I am playing a guessing game.

I would rather say that the memory is statically linked so you can
access the data even after you have exited the function.

Oh, btw what should my reply be to an interviewer who asks this
question ? I tried reasoning with him (and thats not in one interview
but many) in most polite terms (AFAIK) with above statements but he
would not listen. Please let me know what my response be.


I wouldn't have listened either.
It's not a linkage issue.
The object refered to by a string literal has "static duration".
Scope and Linkage are separate issues, related to each other.

Stack and heap questions, as in "the stack" and "the heap",
belong on a newsgroup that deals with the particular
implementation involved.

Portable implementations of qsort as a heapsort,
or qsort with a stack instead of recursion,
might be on topic here.

--
pete
Apr 11 '06 #12
we******@gmail.com wrote:
.... snip ...
If you don't need the job that badly, or you reject the job for
the content of this question (and possibly others) then tell him
to compile it up for himself, trace it with a debugger and he
will see that it is neither on the stack, nor in the heap (the
address ranges will almost surely not match up -- and on a
standard x86 you will *know* its not on the stack because its
not using stack instructions to access it). If the interviewer
is using the latest MS Visual studio, tell him to try to execute
p[0] = 'x', and ask him which of the heap or the stack he thinks
can contain read-only memory.


I think the presence of two copies of this reply, with posting
times separated by 90 minutes, from someone whom I assume knows
better than to double post, settles the fact that these things are
another artifact of the broken google interface.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Apr 11 '06 #13
CBFalconer wrote:

[snip]
I think the presence of two copies of this reply, with posting
times separated by 90 minutes, from someone whom I assume knows
better than to double post, settles the fact that these things are
another artifact of the broken google interface.


At various times, Google will have a problem where it reports that a
message had an error in posting, but it's actually gone out fine. This
will trick people into multiple postings. The past few days it's seemed
like this has been happening with some frequency.


Brian
Apr 11 '06 #14

Keith Thompson wrote:
"Jaspreet" <js***********@gmail.com> writes:
mangesh wrote:
When we write

char *p = "xyz" ;

Many books state that compiler stores "xyz" in memory and returns
pointer to that memory
which is assigned to p . My question is , in what type of memory ,
heap or stack ?

Regards
Mangesh .
I was wondering if the standard actually talks of stack or heap. I
guess not. But again I am playing a guessing game.


It doesn't.
I would rather say that the memory is statically linked so you can
access the data even after you have exited the function.


I'd say statically allocated, not statically linked.


Oh! yes, not sure why I wrote linked instead of allocation. Thanks for
pointing that out.
Oh, btw what should my reply be to an interviewer who asks this
question ? I tried reasoning with him (and thats not in one interview
but many) in most polite terms (AFAIK) with above statements but he
would not listen. Please let me know what my response be.
Storage duration is described in C99 6.2.4.

Many C implementations do use a "stack" (for objects with "automatic
storage duration" and other per-call data) and a "heap" (for objects
with "allocated storage duration"). It's unlikely that such an
implementation would use either stack or heap for string literals.

This probably isn't the best place to ask about interview strategies.
Personally, if I know I'm right about something during a job
interview, I'm not going to back down because the interviewer thinks
he's smarter than I am. (And it's always possible the interviewer is
deliberately testing me.) But I take absolutely no responsibility for
the consequences of treating this observation as advice.


Actually tried this strategy a couple of times with no luck. :(

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


Apr 12 '06 #15

we******@gmail.com wrote:
Jaspreet wrote:
mangesh wrote:
When we write

char *p = "xyz" ;

Many books state that compiler stores "xyz" in memory and returns
pointer to that memory
which is assigned to p . My question is , in what type of memory ,
heap or stack ?

Regards
Mangesh .


I was wondering if the standard actually talks of stack or heap. I
guess not. But again I am playing a guessing game.

I would rather say that the memory is statically linked so you can
access the data even after you have exited the function.

Oh, btw what should my reply be to an interviewer who asks this
question ? I tried reasoning with him (and thats not in one interview
but many) in most polite terms (AFAIK) with above statements but he
would not listen. Please let me know what my response be.


If you need the job then say its on the stack because you cannot call
free() on it, or any containing object. Then if you get the job
compile the source yourrself, decompile it, then show him that it is in
the init segment. Then point him to documentation about how your OS
loads segments into memory, and that segments are not part of any
"stack".

If you don't need the job that badly, or you reject the job for the
content of this question (and possibly others) then tell him to compile
it up for himself, trace it with a debugger and he will see that it is
neither on the stack, nor in the heap (the address ranges will almost
surely not match up -- and on a standard x86 you will *know* its not on
the stack because its not using stack instructions to access it). If
the interviewer is using the latest MS Visual studio, tell him to try
to execute p[0] = 'x', and ask him which of the heap or the stack he
thinks can contain read-only memory.

Good advice. Thanks.

Apr 12 '06 #16
Default User wrote:
CBFalconer wrote:

[snip]
I think the presence of two copies of this reply, with posting
times separated by 90 minutes, from someone whom I assume knows
better than to double post, settles the fact that these things
are another artifact of the broken google interface.


At various times, Google will have a problem where it reports
that a message had an error in posting, but it's actually gone
out fine. This will trick people into multiple postings. The
past few days it's seemed like this has been happening with
some frequency.


If that had been the case the posting times would be quite
similar. The 90 minute delta is the key clue here. Unless Paul
remembers what happened.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Apr 12 '06 #17
CBFalconer wrote:
we******@gmail.com wrote:
... snip ...
If you don't need the job that badly, or you reject the job for
the content of this question (and possibly others) then tell him
to compile it up for himself, trace it with a debugger and he
will see that it is neither on the stack, nor in the heap (the
address ranges will almost surely not match up -- and on a
standard x86 you will *know* its not on the stack because its
not using stack instructions to access it). If the interviewer
is using the latest MS Visual studio, tell him to try to execute
p[0] = 'x', and ask him which of the heap or the stack he thinks
can contain read-only memory.


I think the presence of two copies of this reply, with posting
times separated by 90 minutes, from someone whom I assume knows
better than to double post, settles the fact that these things are
another artifact of the broken google interface.


Uhh ... no, I actually pressed post twice. I have been using a broken
mouse that's been screwing me up lately. The people at Google know
what race condition is, even if the hardware manufacturers at Microsoft
do not. I've since upgraded to a mouse by Logitech, and hopefully this
sort of thing won't happen in the future.

--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

Apr 13 '06 #18
we******@gmail.com writes:
[...]
Uhh ... no, I actually pressed post twice. I have been using a broken
mouse that's been screwing me up lately. The people at Google know
what race condition is, even if the hardware manufacturers at Microsoft
do not. I've since upgraded to a mouse by Logitech, and hopefully this
sort of thing won't happen in the future.


So after you press the "post" button, Google leaves the button active?

Sheesh!

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Apr 13 '06 #19
Keith Thompson wrote:
we******@gmail.com writes:
[...]
Uhh ... no, I actually pressed post twice. I have been using a broken
mouse that's been screwing me up lately. The people at Google know
what race condition is, even if the hardware manufacturers at Microsoft
do not. I've since upgraded to a mouse by Logitech, and hopefully this
sort of thing won't happen in the future.


So after you press the "post" button, Google leaves the button active?


No, after I pressed post -- I don't know if my mouse actually sent the
message or not, unless Google is reacting very quickly; sometimes it
does, sometimes it does not (and sometimes it responds with a sever
error but you can always go back and repost without losing your post).
So I pressed post again thinking my mouse click hadn't gone through.

Whatever, the point is that it was a user error motivated by bad
hardware. You can try to accuse Google of having too much response
variance, but I am not sure that isn't true of just about every USENET
server out there as well.

--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

Apr 13 '06 #20
<we******@gmail.com> wrote:
Whatever, the point is that it was a user error motivated by bad
hardware. You can try to accuse Google of having too much response
variance, but I am not sure that isn't true of just about every USENET
server out there as well.


Nah, the point is to criticize Google for not handling the multiple
submit problem, which is a basic thing to do for pretty much any web
application in the world. It shouldn't matter how many times you click
the submit button.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Apr 16 '06 #21

"Chris Smith" <cd*****@twu.net> wrote in message
news:MP************************@news.altopia.net.. .
<we******@gmail.com> wrote:
Whatever, the point is that it was a user error motivated by bad
hardware. You can try to accuse Google of having too much response
variance, but I am not sure that isn't true of just about every USENET
server out there as well.


Nah, the point is to criticize Google for not handling the multiple
submit problem, which is a basic thing to do for pretty much any web
application in the world. It shouldn't matter how many times you click
the submit button.


Posting complaints _here_ about Google related posts improves nothing...
Google complaints should be directed to Googles complaint department.
RP
Apr 16 '06 #22
"Rod Pemberton" <do*********@sorry.bitbuck.cmm> writes:
[...]
Posting complaints _here_ about Google related posts improves nothing...
Not true. There are workarounds, as you know perfectly well.
Google complaints should be directed to Googles complaint department.


Yes, that too.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Apr 16 '06 #23
Chris Smith wrote:
<we******@gmail.com> wrote:
Whatever, the point is that it was a user error motivated by bad
hardware. You can try to accuse Google of having too much response
variance, but I am not sure that isn't true of just about every USENET
server out there as well.


Nah, the point is to criticize Google for not handling the multiple
submit problem, which is a basic thing to do for pretty much any web
application in the world. It shouldn't matter how many times you click
the submit button.


Right -- so I'm sure I pressed back, then post again. Remember that I
didn't know whether it was my failed mouse hardware or just Google
being slow. Pressing back doesn't lose the data, so that's the
deterministic procedure I chose.

Its not a Google synchronization problem, since I literally submitted
the post twice; unless you expect Google to see that its clearly the
same input and that it should squash the "dual" post. That's plausible
-- but its a *rare* problem. Remember, I needed to have knowingly
failing hardware with a willingness to continue to use it for me to use
Google to double post incorrectly like this. I think the standard
should be if you see that happening on a regular basis, which I don't
think is the case.

--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

Apr 18 '06 #24
we******@gmail.com writes:
Chris Smith wrote:
<we******@gmail.com> wrote:
> Whatever, the point is that it was a user error motivated by bad
> hardware. You can try to accuse Google of having too much response
> variance, but I am not sure that isn't true of just about every USENET
> server out there as well.


Nah, the point is to criticize Google for not handling the multiple
submit problem, which is a basic thing to do for pretty much any web
application in the world. It shouldn't matter how many times you click
the submit button.


Right -- so I'm sure I pressed back, then post again. Remember that I
didn't know whether it was my failed mouse hardware or just Google
being slow. Pressing back doesn't lose the data, so that's the
deterministic procedure I chose.

Its not a Google synchronization problem, since I literally submitted
the post twice; unless you expect Google to see that its clearly the
same input and that it should squash the "dual" post. That's plausible
-- but its a *rare* problem. Remember, I needed to have knowingly
failing hardware with a willingness to continue to use it for me to use
Google to double post incorrectly like this. I think the standard
should be if you see that happening on a regular basis, which I don't
think is the case.


It is. We regularly see multiple identical postings from Google,
typically less than a minute apart.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Apr 18 '06 #25

we******@gmail.com wrote:
Chris Smith wrote:
<we******@gmail.com> wrote:
Whatever, the point is that it was a user error motivated by bad
hardware. You can try to accuse Google of having too much response
variance, but I am not sure that isn't true of just about every USENET
server out there as well.


Nah, the point is to criticize Google for not handling the multiple
submit problem, which is a basic thing to do for pretty much any web
application in the world. It shouldn't matter how many times you click
the submit button.


Right -- so I'm sure I pressed back, then post again. Remember that I
didn't know whether it was my failed mouse hardware or just Google
being slow. Pressing back doesn't lose the data, so that's the
deterministic procedure I chose.

Its not a Google synchronization problem, since I literally submitted
the post twice; unless you expect Google to see that its clearly the
same input and that it should squash the "dual" post. That's plausible
-- but its a *rare* problem. Remember, I needed to have knowingly
failing hardware with a willingness to continue to use it for me to use
Google to double post incorrectly like this. I think the standard
should be if you see that happening on a regular basis, which I don't
think is the case.


Google could easily encode an identifier on the submit button to
identify multpile posts. They have poor interface logic. karl m

Apr 18 '06 #26

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3518
by: Yang Song | last post by:
HI, I am a little confused about char * and char. How would I be able to return a char* created in a function? Is new() the only way? How would I be able to return a point and a value at the same time? I thought of a possible solution. However, I am not quite sure if I understood char vs. char*. Any insight is greatly appreciated. Here is...
24
3126
by: Norm | last post by:
Could someone explain for me what is happening here? char *string; string = new char; string = "This is the string"; cout << string << std::endl; The output contains (This the string) even though I only allocated 5 characters in memory with new.
9
2193
by: Christopher Benson-Manica | last post by:
I need a smart char * class, that acts like a char * in all cases, but lets you do some std::string-type stuff with it. (Please don't say to use std::string - it's not an option...). This is my attempt at it, but it seems to be lacking... I'm aware that strdup() is nonstandard (and a bad idea for C++ code) - please just bear with me: /*...
22
12721
by: Simon | last post by:
Hi, I have written a function to trim char *, but I have been told that my way could be dangerous and that I should use memmove(...) instead. but I am not sure why my code could be 'dangerous' or even why there could be a problem. here is the code ////////
4
11536
by: Radde | last post by:
Hi, class String { public: String(char* str); void operator char*();
2
3391
by: Peter Nilsson | last post by:
In a post regarding toupper(), Richard Heathfield once asked me to think about what the conversion of a char to unsigned char would mean, and whether it was sensible to actually do so. And pete has raised a doubt in my mind on the same issue. Either through ignorance or incompetence, I've been unable to resolve some issues. 6.4.4.4p6...
5
3940
by: jab3 | last post by:
(again :)) Hello everyone. I'll ask this even at risk of being accused of not researching adequately. My question (before longer reasoning) is: How does declaring (or defining, whatever) a variable **var make it an array of pointers? I realize that 'char **var' is a pointer to a pointer of type char (I hope). And I realize that with...
8
10059
by: andrew.fabbro | last post by:
In a different newsgroup, I was told that a function I'd written that looked like this: void myfunc (char * somestring_ptr) should instead be void myfunc (const char * somestring_ptr) When I asked why, I was told that it facilitated calling it as:
18
4025
by: Pedro Pinto | last post by:
Hi there once more........ Instead of showing all the code my problem is simple. I've tried to create this function: char temp(char *string){ alterString(string); return string;
20
3508
by: liujiaping | last post by:
I'm confused about the program below: int main(int argc, char* argv) { char str1 = "abc"; char str2 = "abc"; const char str3 = "abc"; const char str4 = "abc"; const char* str5 = "abc";
0
7269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7394
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5701
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.