Interview Question
0of 0 votesHow will you return
int
and
char
from a function in C?
Country: United States
x is on stack. You won't be able to access on return. Allocating on heap and then returning the pointer can be one way.
int func(char * c, int a){
c=....; /* pointer to the char so changes will b reflected*/
a=....;
return (a);
}

- Anonymous on July 16, 2012 Edit | Flag Replystruct A { int a; char c; }; A doSomething() { A x; return (x); }