You have not allocated any memory space and assign it to the pointers.
Hint: Read about malloc() or calloc() and free().
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...]On Behalf Of
> Calvin Mills
> Sent: Monday, January 15, 2001 7:25 AM
> To: Dev-Cpp-Users
> Subject: [Dev-C++] how do you pass strings in pointers?
>
>
> I am trying to pass a adjusted string pointer back to original
> function and
> I am not able to read it, I am able to send it ok, and I can manipulate it
> fine !!! the problem is when I try to work with it after it has been
> changed(back in the original function) it looks as if their is nothing
> their?
>
> the code is below
>
>
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
>
> void token(char *,char *,char *);
>
> int main()
> {
> char s_phone[18],*area,*number;
> double dnumber;
> int darea;
>
> token(s_phone,area,number);
> //puts(area);
> //dnumber = atol(number); // converts string to long
> //darea = atoi(area); // converts string to int
>
> return 0;
> }
>
>
> /****************************************************************
> * Function to token out the parts of the phone number **
> ***************************************************************/
>
> void token(char *phoneptr,char *areaptr,char *numberptr)
> {
> }
>
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|