CPL Program
CPL Program
Pointer: A pointer is a
variable that stores the
memory address of another
variable as its value. A pointer
variable points to a data type
(like int ) of the same type,
and is created with the *
operator.
Command-line arguments:
Command-line arguments are What is the use of # define?
arguments that are indicated The #define creates a macro,
after the name of the which is the association of an
program in the framework's identifier or parameterized
order line, and these identifier with a token string.
arguments are given to your After the macro is defined,
program during program the compiler can substitute
execution. the token string for each
occurrence of the identifier in
the source file.
WAP to sort an array WAP to sum and Avg. of array WAP to check prime no.
int comp(const void* a, const void* b) { float sum = 0.0, average; if (n <= 1) return false;
// If a is smaller, positive value will be returned printf("Enter the number of elements: "); for (int i = 2; i <= n / 2; i++) {
} int arr[n]; }
} return 0; else
t2 = nextTerm;
printf("\n");
int main() {
int n;
scanf("%d", &n);
What is header file? How to use it?
if (n < 1) {
A text file that contains definitions and
printf("Please enter a positive structures for C programs, such as
integer.\n"); function definitions, variable
declarations, and macro definitions
} else if (n == 1) {
How to use_Header files are included in
printf("Fibonacci Series: 0\n"); a program using the preprocessing
directive #include.
} else {
Recursion in c programming
generateFibonacci(n);
a technique where a function calls itself
}
directly or indirectly to solve a problem.
return 0; It is a powerful tool for solving problems
that can be broken down into smaller,
} similar subproblems. Recursion is often
used in algorithms for tasks such as
return 0; searching, sorting, and traversing data
structures like trees and graphs.
}
Passing array to function (with
example)