-
What will be the output of the following C code?
#include <stdio.h>
struct Item
{
int s;
int t;
};
void function(struct Item*);
int main()
{
struct Item I = {33, 44};
function(&I);
}
void function(struct Item *ptr)
{
printf("%d\n", *ptr->s++);
}
-
- 33
- Compilation Error
- 44
- Garbage value
- None of these
Correct Option: B
Compilation Error
main.c: In function ‘function’:
main.c:15:24: error: invalid type argument of unary ‘*’ (have ‘int’)
printf("%d\n", *ptr->s++);