Given the following C code:
struct department {
char name[20];
int id;
};
struct department d;
add a typedef to allow easy declaration of departments and add some code that uses the typedef.
Given the following C code:
struct department {
char name[20];
int id;
};
struct department d;
add a typedef to allow easy declaration of departments and add some code that uses the typedef.
What is a register variable in C? When would you use one? What is the downside of using this storage class?
What would the following C code print out?:
#include <stdio.h>
main()
{
int i=2,j=3;
i=j++ + i++;
j=++j + ++i;
printf("%d%d\n",i,j);
}
Explain what the following code does:
#include <stdio.h>
int main()
{
int i;
int *p;
i = 2;
p = &i;
*p = 3;
printf("%d\n", i);
return 0;
}
Explain the difference between pass by value and pass by reference in a C program. Write a short program that illustrates the difference.