- What is struct in C?
- How are the fields of a struct passed into a function - by value or by reference?
- What is the size of a struct? What is structure padding in C?
- What is the difference between lifetime and scope of a variable?
- What is variable shadowing (i.e. hiding)?
-
What is the output of the below program?
#include <stdio.h> int foo; void bar() { int foo = 3; { extern int foo; printf("%d; ", foo); foo = 2; } printf("%d; ", foo); } void baz() { printf("%d; ", foo); } int main() { { int foo = 5; bar(); printf("%d; ", foo); } baz(); return 0; }
- Explain what
srand
andrand
functions do exactly.