Hi guys, I need help with identifying type declaration of variable p.
I've attempted, but I am not certain of my answers.
Can someone help me out please ?
1)
Code:
int *vals[5] = [1,3,5,3,5];
p = *vals[2];
p is of type of third pointer of array of 5 pointer to int ?
2)
Code:
char *foo(int x)
{
...
.
...
}
foo is a type of pointer to function returing char ?
p is of type char ?
3)
Code:
typedef unsigned short u_int16_t;
u_int16_t *val = ...;
p = *val;
val is of type pointer to u_int16_t of type unsigned short ?
p is type pointer to u_int16_t of type unsigned short ?
4)
Code:
p = printf("Hello!")
p is of type int; returns the number of characters printed, ?
5)
Code:
struct trapframe
{
u_int32_t tf_vaddr; /* coprocessor 0 vaddr register */
u_int32_t tf_status; /* coprocessor 0 status register */
...
u_int32_t tf_v0; /* Saved register 2 (v0) */
...
};
struct trapframe *tf = ...;
tf is a type of pointer to struct trapframe ?
p is of type u_int32_t ?
6)
Code:
struct trapframe tf = ...;
p = &tf.tf_v0;
p is of type u_int32_t as well ?
Thank you very much in advance !