Samsung Interview Report
- 0of 0 votes
Answerswhat is the return value of the function that returns int, but isn't returning anything explicitly.
for instance output ofint fun() { printf("\ncrap"); } void main() { printf("\n return value of fun %d", fun()); }
i said, should be exit status of 0(success) or value in EPI register, but looks like i wasn't corret. He said, this has something to do with stack unwinding??
- Varun November 06, 2011 in India
Any insights?| Report Duplicate | Flag | PURGE
Samsung Software Engineer / Developer C - 0of 0 votes
Answers2. write sizeof operator.
I gave the code as#define sizeof(data) {data *p=0; size = abs((p+1) - (p))
He was fine with this.
- Varun November 06, 2011 in India
But then how would we extend this to find sizeof of variables???
PS: sizeof in C that we use works well for both datastruct and variable.| Report Duplicate | Flag | PURGE
Samsung Software Engineer / Developer C
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.