ru
Feedback
C Programming Codes

C Programming Codes

Открыть в Telegram

C Programming Codes || Quizzes || DSA Learn along with the community Any queries admin - @Pradeep_saii

Больше

📈 Аналитический обзор Telegram-канала C Programming Codes

Канал C Programming Codes (@c_programming_codes) языкового сегмента Английский является активным участником. Сейчас сообщество объединяет 13 431 подписчиков, занимая 9 534 место в категории Технологии и приложения и 32 075 место в регионе Индия.

📊 Показатели аудитории и динамика

С момента создания невідомо проект демонстрирует стремительный рост, собрав аудиторию из 13 431 подписчиков.

Согласно последним данным от 11 июня, 2026, канал показывает стабильную активность. За последние 30 дней изменение числа участников составило -239, а за последние 24 часа — -9, при этом общий охват остаётся высоким.

  • Статус верификации: Не верифицирован
  • Уровень вовлечённости (ER): Средний показатель вовлечённости аудитории составляет 9.78%. В первые 24 часа после публикации контент обычно набирает N/A% реакций от общего числа подписчиков.
  • Охват публикаций: В среднем каждый пост получает 0 просмотров. В течение первых суток публикация набирает 0 просмотров.
  • Реакции и взаимодействия: Аудитория активно поддерживает контент: среднее количество реакций на один пост — 0.
  • Тематические интересы: Контент сосредоточен на ключевых темах, таких как input, string, scanf("%d, array, element.

📝 Описание и контентная политика

Автор описывает ресурс как площадку для выражения субъективного мнения:
C Programming Codes || Quizzes || DSA Learn along with the community Any queries admin - @Pradeep_saii

Благодаря высокой частоте обновлений (последние данные получены 12 июня, 2026) канал поддерживает актуальность и высокий уровень охвата публикаций. Аналитика показывает, что аудитория активно взаимодействует с контентом, что делает его важной точкой влияния в категории Технологии и приложения.

13 431
Подписчики
-924 часа
-577 дней
-23930 день
Архив постов
💻 Nested Structures
#include <stdio.h>

struct Date {
    int day;
    int month;
    int year;
};

struct Student {
    char name[50];
    int rollNumber;
    struct Date birthday;
};

int main() {
    struct Student student1;

    printf("Enter student name: ");
    scanf("%s", student1.name);

    printf("Enter roll number: ");
    scanf("%d", &student1.rollNumber);

    printf("Enter birthday (day month year): ");
    scanf("%d %d %d", &student1.birthday.day, &student1.birthday.month, &student1.birthday.year);

    printf("nStudent Details:n");
    printf("Name: %sn", student1.name);
    printf("Roll Number: %dn", student1.rollNumber);
    printf("Birthday: %d/%d/%dn", student1.birthday.day, student1.birthday.month, student1.birthday.year);

    return 0;
}
📤 Output:
Input: JohnDoe
Input: 123
Input: 15 08 2000
Output: Enter student name: Enter roll number: Enter birthday (day month year):
Student Details:
Name: JohnDoe
Roll Number: 123
Birthday: 15/8/2000

💻 Circle Area and Circumference
#include <stdio.h>
#define PI 3.14159

struct Circle {
    float radius;
};

int main() {
    struct Circle myCircle;

    printf("Enter the radius of the circle: ");
    scanf("%f", &myCircle.radius);

    float area = PI * myCircle.radius * myCircle.radius;
    float circumference = 2 * PI * myCircle.radius;

    printf("Area of the circle: %.2fn", area);
    printf("Circumference of the circle: %.2fn", circumference);

    return 0;
}
📤 Output:
Input: 5
Output: Enter the radius of the circle: Area of the circle: 78.54
Circumference of the circle: 31.42

💻 Rectangle Area and Perimeter
#include <stdio.h>

struct Rectangle {
    float length;
    float width;
};

int main() {
    struct Rectangle myRectangle;

    printf("Enter the length of the rectangle: ");
    scanf("%f", &myRectangle.length);

    printf("Enter the width of the rectangle: ");
    scanf("%f", &myRectangle.width);

    float area = myRectangle.length * myRectangle.width;
    float perimeter = 2 * (myRectangle.length + myRectangle.width);

    printf("Area of the rectangle: %.2fn", area);
    printf("Perimeter of the rectangle: %.2fn", perimeter);

    return 0;
}
📤 Output:
Input: 5.0
Input: 3.0
Output: Area of the rectangle: 15.00
Output: Perimeter of the rectangle: 16.00

💻 Bank Account Management
#include <stdio.h>
#include <string.h>

struct Account {
    int accountNumber;
    char accountHolderName[50];
    float balance;
};

int main() {
    struct Account myAccount;

    printf("Enter account number: ");
    scanf("%d", &myAccount.accountNumber);

    printf("Enter account holder name: ");
    scanf(" %[^n]s", myAccount.accountHolderName);

    printf("Enter initial balance: ");
    scanf("%f", &myAccount.balance);

    printf("nAccount Details:n");
    printf("Account Number: %dn", myAccount.accountNumber);
    printf("Account Holder Name: %sn", myAccount.accountHolderName);
    printf("Balance: %.2fn", myAccount.balance);

    float depositAmount;
    printf("nEnter amount to deposit: ");
    scanf("%f", &depositAmount);
    myAccount.balance += depositAmount;
    printf("New balance after deposit: %.2fn", myAccount.balance);

    float withdrawalAmount;
    printf("nEnter amount to withdraw: ");
    scanf("%f", &withdrawalAmount);
    if (withdrawalAmount <= myAccount.balance) {
        myAccount.balance -= withdrawalAmount;
        printf("New balance after withdrawal: %.2fn", myAccount.balance);
    } else {
        printf("Insufficient balance.n");
    }

    return 0;
}
📤 Output:
Input: 12345
Input: John Doe
Input: 1000.00
Output: Enter account number: Enter account holder name: Enter initial balance:
Account Details:
Account Number: 12345
Account Holder Name: John Doe
Balance: 1000.00
Enter amount to deposit: Input: 500.00
Output: New balance after deposit: 1500.00
Enter amount to withdraw: Input: 200.00
Output: New balance after withdrawal: 1300.00

💻 Book Library System
#include <stdio.h>
#include <string.h>

struct Book {
    char title[50];
    char author[50];
    int book_id;
};

int main() {
    struct Book book1;

    printf("Enter book title: ");
    scanf(" %[^n]s", book1.title);

    printf("Enter author name: ");
    scanf(" %[^n]s", book1.author);

    printf("Enter book ID: ");
    scanf("%d", &book1.book_id);

    printf("nBook Details:n");
    printf("Title: %sn", book1.title);
    printf("Author: %sn", book1.author);
    printf("Book ID: %dn", book1.book_id);

    return 0;
}
📤 Output:
Input: The Lord of the Rings
Input: J.R.R. Tolkien
Input: 12345
Output: Enter book title: Enter author name: Enter book ID:
Book Details:
Title: The Lord of the Rings
Author: J.R.R. Tolkien
Book ID: 12345

💻 Date Validation and Operations
#include <stdio.h>
#include <stdbool.h>

typedef struct {
    int day;
    int month;
    int year;
} Date;

bool isValidDate(Date date) {
    if (date.year < 1 || date.month < 1 || date.month > 12 || date.day < 1) {
        return false;
    }

    int daysInMonth[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    if ((date.year % 4 == 0 && date.year % 100 != 0) || (date.year % 400 == 0)) {
        daysInMonth[2] = 29;
    }

    if (date.day > daysInMonth[date.month]) {
        return false;
    }

    return true;
}

Date addDays(Date date, int daysToAdd) {
    Date newDate = date;
    int daysInMonth[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    if ((newDate.year % 4 == 0 && newDate.year % 100 != 0) || (newDate.year % 400 == 0)) {
        daysInMonth[2] = 29;
    }

    newDate.day += daysToAdd;

    while (newDate.day > daysInMonth[newDate.month]) {
        newDate.day -= daysInMonth[newDate.month];
        newDate.month++;
        if (newDate.month > 12) {
            newDate.month = 1;
            newDate.year++;
            if ((newDate.year % 4 == 0 && newDate.year % 100 != 0) || (newDate.year % 400 == 0)) {
                daysInMonth[2] = 29;
            } else {
                daysInMonth[2] = 28;
            }
        }
    }

    return newDate;
}

int main() {
    Date myDate;
    int daysToAdd;

    printf("Enter date (day month year): ");
    scanf("%d %d %d", &myDate.day, &myDate.month, &myDate.year);

    if (!isValidDate(myDate)) {
        printf("Invalid date!n");
        return 1;
    }

    printf("Enter number of days to add: ");
    scanf("%d", &daysToAdd);

    Date newDate = addDays(myDate, daysToAdd);

    printf("New date: %d/%d/%dn", newDate.day, newDate.month, newDate.year);

    return 0;
}
📤 Output:
Input: 28 2 2023
Output: Enter date (day month year): Enter number of days to add: 5
New date: 5/3/2023
Input: 31 12 2023
Output: Enter date (day month year): Enter number of days to add: 1
New date: 1/1/2024
Input: 29 2 2024
Output: Enter date (day month year): Enter number of days to add: 1
New date: 1/3/2024
Input: 1 1 2024
Output: Enter date (day month year): Enter number of days to add: 366
New date: 1/1/2025
Input: 31 4 2023
Output: Enter date (day month year): Invalid date!

💻 Time Addition and Subtraction
#include <stdio.h>

struct Time {
    int hours;
    int minutes;
    int seconds;
};

int main() {
    struct Time t1, t2, sum, diff;

    printf("Enter first time (hours minutes seconds): ");
    scanf("%d %d %d", &t1.hours, &t1.minutes, &t1.seconds);

    printf("Enter second time (hours minutes seconds): ");
    scanf("%d %d %d", &t2.hours, &t2.minutes, &t2.seconds);

    // Time Addition
    sum.seconds = t1.seconds + t2.seconds;
    sum.minutes = t1.minutes + t2.minutes + sum.seconds / 60;
    sum.hours = t1.hours + t2.hours + sum.minutes / 60;

    sum.minutes %= 60;
    sum.seconds %= 60;
    sum.hours %= 24;

    printf("Sum of times: %d:%d:%dn", sum.hours, sum.minutes, sum.seconds);

    // Time Subtraction (t1 - t2)
    int t1_sec = t1.hours * 3600 + t1.minutes * 60 + t1.seconds;
    int t2_sec = t2.hours * 3600 + t2.minutes * 60 + t2.seconds;
    int diff_sec = t1_sec - t2_sec;

    if (diff_sec < 0) {
        diff_sec = -diff_sec; //absolute difference
    }

    diff.hours = diff_sec / 3600;
    diff.minutes = (diff_sec % 3600) / 60;
    diff.seconds = (diff_sec % 3600) % 60;

    printf("Difference of times: %d:%d:%dn", diff.hours, diff.minutes, diff.seconds);

    return 0;
}
📤 Output:
Input: 10 30 45
Input: 5 15 20
Output: Sum of times: 15:46:5
Output: Difference of times: 5:15:25

💻 Distance Between Two Points
#include <stdio.h>
#include <math.h>

struct Point {
    float x;
    float y;
};

int main() {
    struct Point p1, p2;
    float distance;

    printf("Enter x and y coordinates for point 1: ");
    scanf("%f %f", &p1.x, &p1.y);

    printf("Enter x and y coordinates for point 2: ");
    scanf("%f %f", &p2.x, &p2.y);

    distance = sqrt(pow(p2.x - p1.x, 2) + pow(p2.y - p1.y, 2));

    printf("Distance between the two points: %fn", distance);

    return 0;
}
📤 Output:
Input: 1.0 2.0
Input: 4.0 6.0
Output: Distance between the two points: 5.000000

💻 Complex Number Operations
#include <stdio.h>

typedef struct {
    float real;
    float imaginary;
} Complex;

Complex add(Complex a, Complex b) {
    Complex result;
    result.real = a.real + b.real;
    result.imaginary = a.imaginary + b.imaginary;
    return result;
}

Complex subtract(Complex a, Complex b) {
    Complex result;
    result.real = a.real - b.real;
    result.imaginary = a.imaginary - b.imaginary;
    return result;
}

int main() {
    Complex num1, num2, sum, difference;

    printf("Enter real and imaginary parts of first complex number: ");
    scanf("%f %f", &num1.real, &num1.imaginary);

    printf("Enter real and imaginary parts of second complex number: ");
    scanf("%f %f", &num2.real, &num2.imaginary);

    sum = add(num1, num2);
    printf("Sum = %.2f + %.2fin", sum.real, sum.imaginary);

    difference = subtract(num1, num2);
    printf("Difference = %.2f + %.2fin", difference.real, difference.imaginary);

    return 0;
}
📤 Output:
Input: 3.4 5.2
Input: -1.1 2.5
Output: Enter real and imaginary parts of first complex number: Enter real and imaginary parts of second complex number: Sum = 2.30 + 7.70i
Output: Difference = 4.50 + 2.70i

💻 Employee Database Management
#include <stdio.h>
#include <string.h>

struct Employee {
    int id;
    char name[50];
    float salary;
};

int main() {
    struct Employee emp;

    printf("Enter employee ID: ");
    scanf("%d", &emp.id);
    printf("Enter employee name: ");
    scanf(" %[^n]s", emp.name);
    printf("Enter employee salary: ");
    scanf("%f", &emp.salary);

    printf("nEmployee Details:n");
    printf("ID: %dn", emp.id);
    printf("Name: %sn", emp.name);
    printf("Salary: %.2fn", emp.salary);

    return 0;
}
📤 Output:
Input: 123
Input: John Doe
Input: 60000.50
Output: Enter employee ID: Enter employee name: Enter employee salary:
Employee Details:
ID: 123
Name: John Doe
Salary: 60000.50

💻 Student Record System
#include <stdio.h>
#include <string.h>

struct Student {
    char name[50];
    int rollNumber;
    float marks;
};

int main() {
    struct Student student1;

    printf("Enter student name: ");
    scanf("%s", student1.name);

    printf("Enter roll number: ");
    scanf("%d", &student1.rollNumber);

    printf("Enter marks: ");
    scanf("%f", &student1.marks);

    printf("nStudent Details:n");
    printf("Name: %sn", student1.name);
    printf("Roll Number: %dn", student1.rollNumber);
    printf("Marks: %.2fn", student1.marks);

    return 0;
}
📤 Output:
Input: John
Input: 123
Input: 85.5
Output: Enter student name: Enter roll number: Enter marks:
Student Details:
Name: John
Roll Number: 123
Marks: 85.50

🔧 Structures and Unions

💻 Array of Structure Pointers
#include <stdio.h>
#include <stdlib.h>

struct Student {
    int id;
    char name[50];
    float gpa;
};

int main() {
    int n;

    printf("Enter the number of students: ");
    scanf("%d", &n);

    struct Student *students[n]; // Array of structure pointers

    // Allocate memory for each student and get input
    for (int i = 0; i < n; i++) {
        students[i] = (struct Student*)malloc(sizeof(struct Student));

        printf("Enter details for student %d:n", i + 1);

        printf("ID: ");
        scanf("%d", &(students[i]->id));

        printf("Name: ");
        scanf(" %[^n]", students[i]->name); // Read name with spaces

        printf("GPA: ");
        scanf("%f", &(students[i]->gpa));
    }

    // Print the student details
    printf("nStudent Details:n");
    for (int i = 0; i < n; i++) {
        printf("Student %d:n", i + 1);
        printf("ID: %dn", students[i]->id);
        printf("Name: %sn", students[i]->name);
        printf("GPA: %.2fn", students[i]->gpa);
    }

    // Free the allocated memory
    for (int i = 0; i < n; i++) {
        free(students[i]);
    }

    return 0;
}
📤 Output:
Input: 2
Input: 123
Input: Alice Smith
Input: 3.85
Input: 456
Input: Bob Johnson
Input: 3.5

Output:
Enter the number of students: Enter details for student 1:
ID: Name: GPA: Enter details for student 2:
ID: Name: GPA:
Student Details:
Student 1:
ID: 123
Name: Alice Smith
GPA: 3.85
Student 2:
ID: 456
Name: Bob Johnson
GPA: 3.50

💻 Pointer to Structure
#include <stdio.h>
#include <stdlib.h>

struct Person {
    char name[50];
    int age;
};

int main() {
    struct Person person1;
    struct Person *ptrPerson;

    ptrPerson = &person1;

    printf("Enter name: ");
    scanf("%s", ptrPerson->name);

    printf("Enter age: ");
    scanf("%d", &ptrPerson->age);

    printf("Name: %sn", ptrPerson->name);
    printf("Age: %dn", ptrPerson->age);

    return 0;
}
📤 Output:
Input: John
Input: 30
Output: Enter name: Enter age: Name: John
Age: 30

💻 Memory Freeing (free)
#include <stdio.h>
#include <stdlib.h>

int main() {
    int *ptr;

    ptr = (int *)malloc(sizeof(int));

    if (ptr == NULL) {
        printf("Memory allocation failed!n");
        return 1;
    }

    printf("Enter an integer value: ");
    scanf("%d", ptr);

    printf("You entered: %dn", *ptr);

    free(ptr);

    ptr = NULL;

    return 0;
}
📤 Output:
Input: 10
Output: Enter an integer value: You entered: 10

💻 Dynamic Memory Reallocation (realloc)
#include <stdio.h>
#include <stdlib.h>

int main() {
    int *arr;
    int size, new_size, i;

    printf("Enter the initial size of the array: ");
    scanf("%d", &size);

    arr = (int *)malloc(size * sizeof(int));

    if (arr == NULL) {
        printf("Memory allocation failed.n");
        return 1;
    }

    printf("Enter %d elements:n", size);
    for (i = 0; i < size; i++) {
        scanf("%d", &arr[i]);
    }

    printf("Enter the new size of the array: ");
    scanf("%d", &new_size);

    arr = (int *)realloc(arr, new_size * sizeof(int));

    if (arr == NULL) {
        printf("Memory reallocation failed.n");
        return 1;
    }

    printf("Memory reallocated successfully.n");

    if (new_size > size) {
        printf("Enter the remaining %d elements:n", new_size - size);
        for (i = size; i < new_size; i++) {
            scanf("%d", &arr[i]);
        }
    }

    printf("Elements of the array:n");
    for (i = 0; i < new_size; i++) {
        printf("%d ", arr[i]);
    }
    printf("n");

    free(arr);

    return 0;
}
📤 Output:
Input: 3
Output: Enter the initial size of the array:
Input: 1
Output: Enter 3 elements:
Input: 2
Output:
Input: 3
Output: Enter the new size of the array:
Input: 5
Output: Memory reallocated successfully.
Output: Enter the remaining 2 elements:
Input: 4
Output:
Input: 5
Output: Elements of the array:
Output: 1 2 3 4 5

💻 Dynamic Memory Allocation (malloc, calloc)
#include <stdio.h>
#include <stdlib.h>

int main() {
    int *arr_malloc, *arr_calloc;
    int n, i;

    printf("Enter the number of elements: ");
    scanf("%d", &n);

    arr_malloc = (int*) malloc(n * sizeof(int));
    if (arr_malloc == NULL) {
        printf("Memory allocation failed using malloc!n");
        return 1;
    }

    printf("Memory allocated successfully using malloc.n");

    printf("Enter elements for malloc array:n");
    for (i = 0; i < n; i++) {
        scanf("%d", &arr_malloc[i]);
    }

    printf("Elements in malloc array:n");
    for (i = 0; i < n; i++) {
        printf("%d ", arr_malloc[i]);
    }
    printf("n");

    arr_calloc = (int*) calloc(n, sizeof(int));
    if (arr_calloc == NULL) {
        printf("Memory allocation failed using calloc!n");
        free(arr_malloc);
        return 1;
    }

    printf("Memory allocated successfully using calloc. Initialized to 0.n");

    printf("Enter elements for calloc array:n");
    for (i = 0; i < n; i++) {
        scanf("%d", &arr_calloc[i]);
    }

    printf("Elements in calloc array:n");
    for (i = 0; i < n; i++) {
        printf("%d ", arr_calloc[i]);
    }
    printf("n");

    free(arr_malloc);
    free(arr_calloc);

    return 0;
}
📤 Output:
Input: 3
Output: Enter the number of elements: Memory allocated successfully using malloc.
Enter elements for malloc array:
Input: 10
Input: 20
Input: 30
Output: Elements in malloc array:
10 20 30
Output: Memory allocated successfully using calloc. Initialized to 0.
Enter elements for calloc array:
Input: 40
Input: 50
Input: 60
Output: Elements in calloc array:
40 50 60

💻 Pointer to Function
#include <stdio.h>

int add(int a, int b) {
  return a + b;
}

int subtract(int a, int b) {
  return a - b;
}

int main() {
  int x, y, choice, result;
  int (*operation)(int, int);

  printf("Enter two numbers: ");
  scanf("%d %d", &x, &y);

  printf("Choose an operation:n");
  printf("1. Addn");
  printf("2. Subtractn");
  printf("Enter your choice (1 or 2): ");
  scanf("%d", &choice);

  if (choice == 1) {
    operation = add;
  } else if (choice == 2) {
    operation = subtract;
  } else {
    printf("Invalid choice.n");
    return 1;
  }

  result = operation(x, y);

  printf("Result: %dn", result);

  return 0;
}
📤 Output:
Input: 5 3
Input: 1
Output: Enter two numbers: Choose an operation:
1. Add
2. Subtract
Enter your choice (1 or 2): Result: 8

Input: 10 4
Input: 2
Output: Enter two numbers: Choose an operation:
1. Add
2. Subtract
Enter your choice (1 or 2): Result: 6

Input: 2 7
Input: 3
Output: Enter two numbers: Choose an operation:
1. Add
2. Subtract
Enter your choice (1 or 2): Invalid choice.

💻 Function Pointers
#include <stdio.h>

int add(int a, int b) {
  return a + b;
}

int subtract(int a, int b) {
  return a - b;
}

int main() {
  int x, y, choice, result;
  int (*operation)(int, int);

  printf("Enter two integers: ");
  scanf("%d %d", &x, &y);

  printf("Choose an operation:n");
  printf("1. Addn");
  printf("2. Subtractn");
  printf("Enter your choice (1 or 2): ");
  scanf("%d", &choice);

  if (choice == 1) {
    operation = add;
  } else if (choice == 2) {
    operation = subtract;
  } else {
    printf("Invalid choice.n");
    return 1; // Indicate an error
  }

  result = operation(x, y);

  printf("Result: %dn", result);

  return 0;
}
📤 Output:
Input: 5 3
Input: 1
Output: Enter two integers: Choose an operation:
1. Add
2. Subtract
Enter your choice (1 or 2): Result: 8

Input: 10 4
Input: 2
Output: Enter two integers: Choose an operation:
1. Add
2. Subtract
Enter your choice (1 or 2): Result: 6

Input: 2 7
Input: 3
Output: Enter two integers: Choose an operation:
1. Add
2. Subtract
Enter your choice (1 or 2): Invalid choice.

💻 Pointer to Pointer
#include <stdio.h>

int main() {
    int num = 10;
    int *ptr = &num;
    int **ptr_to_ptr = &ptr;

    printf("Value of num: %dn", num);
    printf("Address of num: %pn", (void*)&num);

    printf("Value of ptr: %pn", (void*)ptr);
    printf("Address of ptr: %pn", (void*)&ptr);
    printf("Value pointed to by ptr: %dn", *ptr);

    printf("Value of ptr_to_ptr: %pn", (void*)ptr_to_ptr);
    printf("Address of ptr_to_ptr: %pn", (void*)&ptr_to_ptr);
    printf("Value pointed to by ptr_to_ptr: %pn", (void*)*ptr_to_ptr);
    printf("Value pointed to by *ptr_to_ptr: %dn", **ptr_to_ptr);

    return 0;
}
📤 Output:
Value of num: 10
Address of num: 0x7ffc75467b18
Value of ptr: 0x7ffc75467b18
Address of ptr: 0x7ffc75467b20
Value pointed to by ptr: 10
Value of ptr_to_ptr: 0x7ffc75467b20
Address of ptr_to_ptr: 0x7ffc75467b28
Value pointed to by ptr_to_ptr: 0x7ffc75467b18
Value pointed to by *ptr_to_ptr: 10