Variables
- What will be the output of the following C code?
#include <stdio.h>
void fun(const int *);
int main()
{
const int k = 12;
printf("%d ", k);
fun(&k);
printf("%d", k);
}
void fun(const int *k)
{
*k = 21;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Cannot change a const type value.
- Which of the following cannot be a variable name in C?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
volatile is C keyword.
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int Eighteen = 18;
int eighteen = 15;
printf("%d", eighteen);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Variable names Eighteen and eighteen are both distinct as C is case sensitive.
- What is the problem in following variable declaration?
float 2B-H-K?;
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
A variable name cannot start with an integer, along with that the C compiler interprets the ‘-‘ and ‘?’ as a minus operator and a question mark operator respectively.
- What will happen if the following C code is executed?
#include <stdio.h>
int main()
{
int var = 15;
printf("%d", var);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
It will run without any error and prints 15.