Functions
- What will be the output of the following C code?
#include <stdio.h>
struct Employee
{
char name[20];
};
void main()
{
struct Employee emp[] = {"AJIT", "KUMAR"};
printf("%c", emp[0].name[1]);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
J
- What will be the output of the following C code?
#include <stdio.h>
enum color{Red, Yellow, Green};
enum color fun();
int main()
{
enum color n = fun();
printf("%d\n", n);
}
int fun()
{
return Red;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Compilation Error
main.c:9:10: error: conflicting types for ‘fun’
int fun()
^~~
main.c:3:16: note: previous declaration of ‘fun’ was here
enum color fun();
- Functions can return enumeration constants in C?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
true
- What will be the output of the following C code?
#include <stdio.h>
int fun();
int main()
{
int n = fun();
}
fun()
{
printf("100");
return 100;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
100
- What is the default return type if it is not specified in function definition?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
int