Functions
- Which of the following is true for "call by reference" in C program?
-
View Hint View Answer Discuss in Forum
In case of call by reference, called function has access to original argument.
Correct Option: A
Call by reference allows called program to access and modigy the original value of the argument passed.
Called function does not need to create a copy of the argument passed
- Which of the following is true for "call by value" in C?
-
View Hint View Answer Discuss in Forum
arguments passed to called funtion are local to the calling function. Calling function cannot modify its value
Correct Option: B
pass by value means that called function is given the value of its arguments in temporary variables rathen than originals.
- Which of the following function with ellipsis are illegal?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
void func(…);
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
struct NN
{
char *name;
struct NN *next;
};
struct NN *ptrary[10];
struct NN n, nn;
n.name = "Rahul";
n.next = NULL;
ptrary[0] = &n;
nn.name = (char*)malloc(sizeof(char)*3);
strcpy(nn.name, n.name);
nn.next = &nn;
ptrary[1] = &nn;
printf("%s\n", ptrary[1]->next->next->name);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Rahul
- What will be the output of the following C code?
#include <stdio.h>
struct Employee
{
char str[];
};
void main()
{
struct Employee Emp;
printf("%d", sizeof(struct Employee));
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
Compilation Error
main.c:4:14: error: flexible array member in a struct with no named members
char str[];