Why are we allowed to run this code:
int* FunctionB(int x)
{
int temp =30;
//more code
return &temp;
}
It seems to me that I am not returning what I said I would. Why is it that a memory address can be returned if I declared the return type to be a pointer. Isn't a pointer something that points to a memory address, not actually a memory address?
class Image : public BMP
{
public:
void invertcolors();
void flipleft();
void adjustbrightness(int r,int g,int b);
private:
};
Upon compilation of the previous code I get this error:
image.h:3: error: expected class-name before ‘{’ token
but I thought I was using the proper syntax to declare a sub class. Is there something wrong with what I have written?