C Programming Answers.
C Programming Answers.
1 {A} . Each variable in C has an associated data type. It specifies the type of
data that the variable can store like integer, character, floating, double, etc.
Each data type requires different amounts of memory and has some specific
operations which can be performed over it. The data type is a collection of
data with values having fixed values, meaning as well as its characteristics.
int var_name;
{B}.
Associativity is a property that determines the grouping of operators with the same
precedence. It defines the direction in which the operations are performed when they
have the same precedence.
The following is a general guideline for the precedence and associativity of common
operators in many programming languages. Operators at the top have higher
precedence, and operators on the same line have the same precedence.
1. Unary Operators:
• +, - (unary plus and minus)
2. Multiplicative Operators:
• * (multiplication)
• / (division)
• % (modulo)
3. Additive Operators:
• + (addition)
• - (subtraction)
4. Relational Operators:
• < (less than)
• > (greater than)
• <= (less than or equal to)
• >= (greater than or equal to)
5. Equality Operators:
• == (equal to)
• != (not equal to)
6. Logical AND:
• &&
7. Logical OR:
• ||
8. Assignment Operators:
• =
• +=, -=, *=, /=, %= (compound assignment operators)
include <stdio.h>
void increment()
int a = 5;
int b = 5;
// PREFIX
// POSTFIX
// Driver code
int main()
increment();
return 0;
Output
Prefix Increment: 6
Postfix Increment: 5
#include <stdio.h>
void decrement()
int a = 5;
int b = 5;
// PREFIX
// POSTFIX
// Driver code
int main()
decrement();
return 0;
Output
Prefix = 4
Postfix = 5
{B}.
2 {A}. #include<stdio.h>
int main(){
int a ;
if (a>0) {
printf("The Number you entered is Positive .");}
else if (a<0) {
printf("The Number you entered is Negative .");
}
else{
printf("The number you entered is Zero.");
return 0;}
OutPut :
{B}.
#include <stdio.h>
int main() {
char char1, char2, char3;
return 0;
}
Output :
ASCII value of a: 97
ASCII value of b: 98
ASCII value of c: 99