Is it possible to do the following in C?
int *NumPtr = & (int) 44;
Or does this need to be done 'through' an intermediary variable, such as:
int Num = 3, *NumPtr;
NumPtr = &Num;
Is it possible to do the following in C?
int *NumPtr = & (int) 44;
Or does this need to be done 'through' an intermediary variable, such as:
int Num = 3, *NumPtr;
NumPtr = &Num;
You can use a compound literal:
int *NumPtr = &(int){44};
Compound literals are usually used to create anonymous arrays or structs, but they can be used as here as well.