Why does a standard swap function not work in Java, even though it uses pass by reference?
Although objects and its variables are manipulated by reference, Java passes all the method parameters by value as a default. The argument references passed to the methods are only copies of the original references. Thus a swap function will not work
What is the difference between class and struct?
The 2 main differences are that in classes the member variables are private by default where as in struct, all member variables are by default public. NOTE : The struct specified here is particular to C++ and is NOT about the structs in C. In C, a struct is just an aggregate of data, and has no class-like features: no methods, no constructor, no base classes, etc and does not support OOP
Write a function that can accept any type of argument but returns an integer`
int func_name(void *ptr)