Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

problem in return double pointer

Status
Not open for further replies.

krishna_1980

Junior Member level 3
Junior Member level 3
Joined
Jan 4, 2006
Messages
25
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,457
return double pointer

how to retern a double pointer from a function.y the following code is not working..
char **func(void);
main()
{
char **ch;
ch=func();
prinyf("%s%s",ch[0],ch[1]);
}
char **func()
{
char *p[2]={"a","b"};
char **k;
k=p;
return(k);
}
 

returning a double pointer

The local variables will be destroyed after the function where they are declared is finished. Thus, you cannot use the result. One simple method is to use a global variable instead of the local variable.
 

you have to use malloc to allocate memory for pointer!!!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top