![]() |
|
#1
|
|||
|
|||
Passing values as pointers?Hello all,
I am new to this forum. and want to thank you for having help for coding. I am not a mooch. I like to try my hand at my code first. Then get some help. What I am trying to do is practice pointers to a function. Below I compiled it but it doesnt display the length of the string? I want to make sure I am passing the values by pointers to the function. So that is where I am at. I do understand they have to be the same data types. Thanks that is a funny emoticon. had to use it CPP / C++ / C Code:
Last edited by LuciWiz : 14-Oct-2009 at 12:00.
Reason: Please insert your C++ code between [cpp] & [/cpp] tags
|
|||
|
#2
|
|||
|
|||
Re: noob..passing values as pointers????oops found on errror but i sang my song too soon back to debug!
but I have another question am I passing pointer correctly in this program?? I am just wondering if I am doing it right? am IT it works now but just because it works does that mean I am passing pointers into theprogram correctly? thanks |
|
#3
|
|||
|
|||
So is this correct way to pass pointers?????--easy question hey gues I got it to work but is this the correct way to pass pointers?I am just making sure I am passing the pointers correctly and initializing the char string correctly???? CPP / C++ / C Code:
Last edited by LuciWiz : 14-Oct-2009 at 12:22.
Reason: Please insert your C++ code between [cpp] & [/cpp] tags
|
|
#4
|
|||
|
|||
Re: noob..passing values as pointers????You have one big error:
CPP / C++ / C Code:
If you wish to store anything into the string, you should allocate it like this: CPP / C++ / C Code:
This would now allow you to enter 31 characters into the string. |
|
#5
|
|||
|
|||
Re: noob..passing values as pointers????hey fakepoo
that name makes me laugh! hey thanks, I was thinking that but hey thanks a lot! for you taking the time to help me..I appreciate your expert advice.. so yu think I am passing with pointers correctly do you? |
|
#7
|
|||
|
|||
Re: noob..passing values as pointers????hey fakepoo thanks for the pointer ref! great
hey look at this it gives me some kind of indirection error? something about char * ??I don't know what that means? compile and run and maybe you can see what I mean? thanks Code:
|
|
#8
|
|||
|
|||
Re: noob..passing values as pointers????CPP / C++ / C Code:
|
|
#9
|
|||
|
|||
Re: noob..passing values as pointers????wow I tried it in mine and it works; wow man i feel so dumb
thanks so much for the explaination and your valuable time I hope I am as good as you some day -thanks fakepoo! ![]() so array can be used with char* since arrays are consider pointers??? is that right? |
|
#10
|
|||
|
|||
Re: noob..passing values as pointers????Quote:
|
Recent GIDBlog
Once again, no time for hobbies by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Functions: Passing pointers vs by reference | dlp | C++ Forum | 0 | 05-Nov-2007 04:36 |
| Sort an array of structures | sassy99 | C Programming Language | 10 | 15-Feb-2007 08:46 |
| [Tutorial] Pointers in C (Part II) | Stack Overflow | C Programming Language | 0 | 27-Apr-2005 18:36 |
| [Tutorial] Pointers in C (Part I) | Stack Overflow | C Programming Language | 1 | 08-Apr-2005 19:35 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The