C Programming Answers Full
C Programming Answers Full
#include <stdio.h>
struct Employee {
char name[50];
int age;
};
int main() {
return 0;
#include <stdio.h>
struct Product {
char name[50];
float price;
int quantity;
float total;
};
void read(struct Product *p) {
int main() {
read(&prod);
print(prod);
return 0;
- Function prototype tells compiler function name, return type, and parameters.
|---------------------------|-----------------------------|
4. Storage Classes in C:
Example (static):
void counter() {
count++;
printf("%d\n", count);
5. Recursion:
#include <stdio.h>
int factorial(int n) {
if (n == 0 || n == 1)
return 1;
int main() {
int num;
scanf("%d", &num);
return 0;
6. Pointer Variable:
int a = 10;
7. Structure vs Union:
|------------|------------------------|--------------------------|
Example (Structure):
Example (Union):
#include <stdio.h>
if (arr[i] == key)
return i;
return -1;
int main() {
int n, key;
scanf("%d", &n);
int arr[n];
scanf("%d", &arr[i]);
scanf("%d", &key);
if (result == -1)
else
return 0;