Re: Cannot return values of char variable



Hi,
yup fuction sinature should be char* and more over when you passing
char* from main to temp and temp to alterstring make sure in
alterstring plays around with its value not address.
else pass alterstring(&string)----making its signature.
char* alterstring(char** str).This way your return string would hold
the new allocated memory address and its value.

Regards
Ap



Pedro Pinto wrote:
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;
}

char alterString(char *string){}

temp receives a string and uses the alterString to modify it.

My issue is simple, when i pass the argument string to alterString it
appears in the function alterString has being empty.

I've tried changing the signatures of the functions to
char temp(char string){
char alterString(char string){}


but the issue still occurs......


Can please somebody give me just a little example of the working
function.......... it would really help.....

thanks in advance for every support you have given to me this night.

.



Relevant Pages

  • Re: simple pointers question
    ... char *temp; ... I'm going to *guess* that you mean that temp2 points to the string ... You've declared temp and temp2; ...
    (comp.lang.c)
  • Re: Unmanaged code(dll) function: int myfunc (char* temp)
    ... //Assigning an value to temp ... I am using char* not TCHAR* ... Can you help me how to get the value of temp when using string builder ... int myfunc ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Cannot return values of char variable
    ... This function is defined as returning a char, but it is trying to return a char *. ... temp receives a string and uses the alterString to modify it. ... when i pass the argument string to alterString it ... Maybe it was empty when passed to temp. ...
    (comp.lang.c)
  • Re: Reverse a string in place
    ... snip ... ... char *end; ... Unless the string is, in which case is undefined. ... char temp; ...
    (comp.lang.c)
  • Re: Charcter Pointer Problem
    ... int main(int argc, char *argv) ... char *temp; ... the start address of the allocated storage. ... While temp gives you the empty string, ...
    (comp.lang.c)