ch
Feedback
C Programming Language || Hands On Coding

C Programming Language || Hands On Coding

前往频道在 Telegram

Hands-on C programming language challenges for beginners. Learn building logic by solving programs. Owner: @Pradeep_saii

显示更多

📈 Telegram 频道 C Programming Language || Hands On Coding 的分析概览

频道 C Programming Language || Hands On Coding (@c_programming_language_coding) 英语 语言赛道中的 是活跃参与者。目前社区聚集了 12 822 名订阅者,在 技术与应用 类别中位列第 9 562,并在 印度 地区排名第 31 207

📊 受众指标与增长动态

невідомо 创建以来,项目保持高速增长,吸引了 12 822 名订阅者。

根据 26 八月, 2026 的最新数据,频道保持稳定运转。过去 30 天订阅人数变化为 -210,过去 24 小时变化为 -2,整体触达仍然可观。

  • 认证状态: 未认证
  • 互动率 (ER): 平均受众互动率为 12.56%。内容发布后 24 小时内通常能获得 2.42% 的反应,占订阅者总量。
  • 帖子覆盖: 每篇帖子平均可获得 1 612 次浏览,首日通常累积 310 次浏览。
  • 互动与反馈: 受众积极参与,单帖平均反应数为 4
  • 主题关注点: 内容集中在 input, string, scanf("%d, array, element 等核心主题上。

📝 描述与内容策略

作者将该频道定位为表达主观观点的平台:
Hands-on C programming language challenges for beginners. Learn building logic by solving programs. Owner: @Pradeep_saii

凭借高频更新(最新数据采集于 27 八月, 2026),频道始终保持新鲜度与高覆盖。分析显示受众积极互动,使其成为 技术与应用 类别中的关键影响点。

12 822
订阅者
-224 小时
-357
-21030
帖子存档
💻 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

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

int main() {
    int num1 = 10, num2 = 20, num3 = 30;

    // Array of pointers to integers
    int *ptr_array[3];

    // Assigning addresses of integers to the pointer array
    ptr_array[0] = &num1;
    ptr_array[1] = &num2;
    ptr_array[2] = &num3;

    // Accessing values using the array of pointers
    printf("Value at ptr_array[0]: %dn", *ptr_array[0]);
    printf("Value at ptr_array[1]: %dn", *ptr_array[1]);
    printf("Value at ptr_array[2]: %dn", *ptr_array[2]);

    return 0;
}
📤 Output:
Value at ptr_array[0]: 10
Value at ptr_array[1]: 20
Value at ptr_array[2]: 30

💻 Pointer Arithmetic Operations
#include <stdio.h>

int main() {
    int arr[] = {10, 20, 30, 40, 50};
    int *ptr = arr;

    printf("Value of arr[0]: %dn", *ptr);

    ptr++; // Increment pointer to point to the next element

    printf("Value of arr[1]: %dn", *ptr);

    printf("Address of arr[1]: %pn", (void*)ptr);

    printf("Value of arr[2]: %dn", *(ptr + 1)); // Accessing arr[2] using pointer arithmetic

    ptr = arr + 3; // Pointing to arr[3]

    printf("Value of arr[3]: %dn", *ptr);

    ptr--; // Decrement pointer

    printf("Value of arr[2]: %dn", *ptr);

    int diff = ptr - arr; // Calculating the difference between pointers

    printf("Difference between pointers: %dn", diff);

    return 0;
}
📤 Output:
Value of arr[0]: 10
Value of arr[1]: 20
Address of arr[1]: 0x7ffc752b1004
Value of arr[2]: 30
Value of arr[3]: 40
Value of arr[2]: 30
Difference between pointers: 2

💻 Compare Strings Using Pointers
#include <stdio.h>
#include <string.h>

int main() {
    char str1[100], str2[100];
    char *ptr1, *ptr2;
    int result = 0;

    printf("Enter the first string: ");
    scanf("%s", str1);

    printf("Enter the second string: ");
    scanf("%s", str2);

    ptr1 = str1;
    ptr2 = str2;

    while (*ptr1 != '0' && *ptr2 != '0') {
        if (*ptr1 != *ptr2) {
            result = (*ptr1 > *ptr2) ? 1 : -1;
            break;
        }
        ptr1++;
        ptr2++;
    }

    if (result == 0 && (*ptr1 == '0' && *ptr2 != '0'))
        result = -1;
    else if (result == 0 && (*ptr1 != '0' && *ptr2 == '0'))
        result = 1;

    if (result == 0) {
        printf("Strings are equal.n");
    } else if (result > 0) {
        printf("String 1 is greater than String 2.n");
    } else {
        printf("String 1 is less than String 2.n");
    }

    return 0;
}
📤 Output:
Input: apple
Input: banana
Output: String 1 is less than String 2.

Input: banana
Input: apple
Output: String 1 is greater than String 2.

Input: apple
Input: apple
Output: Strings are equal.

Input: apple
Input: app
Output: String 1 is greater than String 2.

Input: app
Input: apple
Output: String 1 is less than String 2.

Input: A
Input: a
Output: String 1 is less than String 2.

Input: abc
Input: abd
Output: String 1 is less than String 2.

💻 Concatenate Strings Using Pointers
#include <stdio.h>
#include <string.h>

int main() {
  char str1[100], str2[100];

  printf("Enter the first string: ");
  scanf("%s", str1);

  printf("Enter the second string: ");
  scanf("%s", str2);

  char *ptr1 = str1;
  char *ptr2 = str2;

  // Move pointer to the end of the first string
  while (*ptr1 != '0') {
    ptr1++;
  }

  // Concatenate the second string to the first
  while (*ptr2 != '0') {
    *ptr1 = *ptr2;
    ptr1++;
    ptr2++;
  }

  *ptr1 = '0'; // Null-terminate the concatenated string

  printf("Concatenated string: %sn", str1);

  return 0;
}
📤 Output:
Input: Hello
Input: World
Output: Concatenated string: HelloWorld

💻 Find Length of String Using Pointers
#include <stdio.h>

int main() {
    char str[100];
    char *ptr;
    int length = 0;

    printf("Enter a string: ");
    scanf("%s", str);

    ptr = str;

    while (*ptr != '0') {
        length++;
        ptr++;
    }

    printf("Length of the string: %dn", length);

    return 0;
}
📤 Output:
Input: Hello
Output: Length of the string: 5

Input: C programming
Output: Length of the string: 1

Input: This is a test
Output: Length of the string: 4

💻 Sort Array Using Pointers
#include <stdio.h>

void sortArray(int *arr, int size) {
    int i, j, temp;
    for (i = 0; i < size - 1; i++) {
        for (j = 0; j < size - i - 1; j++) {
            if (*(arr + j) > *(arr + j + 1)) {
                temp = *(arr + j);
                *(arr + j) = *(arr + j + 1);
                *(arr + j + 1) = temp;
            }
        }
    }
}

int main() {
    int size, i;

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

    int arr[size];

    printf("Enter the elements of the array:n");
    for (i = 0; i < size; i++) {
        scanf("%d", (arr + i));
    }

    sortArray(arr, size);

    printf("Sorted array:n");
    for (i = 0; i < size; i++) {
        printf("%d ", *(arr + i));
    }
    printf("n");

    return 0;
}
📤 Output:
Input: 5
Input: 5
Input: 4
Input: 3
Input: 2
Input: 1
Output: Enter the size of the array: Enter the elements of the array:
Sorted array:
1 2 3 4 5

💻 Reverse Array Using Pointers
#include <stdio.h>

int main() {
    int n;

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

    int arr[n];

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

    int *start = arr;
    int *end = arr + n - 1;
    int temp;

    while (start < end) {
        temp = *start;
        *start = *end;
        *end = temp;
        start++;
        end--;
    }

    printf("Reversed array:n");
    for (int i = 0; i < n; i++) {
        printf("%d ", arr[i]);
    }
    printf("n");

    return 0;
}
📤 Output:
Input: 5
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Output: Enter the size of the array: Enter the elements of the array:
Reversed array:
5 4 3 2 1

💻 Copy Array Using Pointers
#include <stdio.h>

int main() {
    int n;

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

    int source[n];
    int destination[n];
    int *sourcePtr = source;
    int *destinationPtr = destination;

    printf("Enter elements of the source array:n");
    for (int i = 0; i < n; i++) {
        scanf("%d", sourcePtr + i);
    }

    for (int i = 0; i < n; i++) {
        *(destinationPtr + i) = *(sourcePtr + i);
    }

    printf("Elements of the destination array:n");
    for (int i = 0; i < n; i++) {
        printf("%d ", *(destinationPtr + i));
    }
    printf("n");

    return 0;
}
📤 Output:
Input: 5
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Output: Enter the size of the array: Enter elements of the source array:
Elements of the destination array:
1 2 3 4 5

💻 Access Array Elements Using Pointers
#include <stdio.h>

int main() {
    int arr[5] = {10, 20, 30, 40, 50};
    int *ptr = arr; // Pointer to the first element of the array

    printf("Accessing array elements using pointers:n");

    for (int i = 0; i < 5; i++) {
        printf("Element %d: %dn", i, *(ptr + i)); // Accessing element at index i using pointer arithmetic
    }

    printf("nAccessing array elements using pointer increment:n");

    ptr = arr; // Reset the pointer to the beginning of the array
    for (int i = 0; i < 5; i++) {
        printf("Element %d: %dn", i, *ptr);
        ptr++; // Increment the pointer to point to the next element
    }

    return 0;
}
📤 Output:
Accessing array elements using pointers:
Element 0: 10
Element 1: 20
Element 2: 30
Element 3: 40
Element 4: 50

Accessing array elements using pointer increment:
Element 0: 10
Element 1: 20
Element 2: 30
Element 3: 40
Element 4: 50

💻 Swap Two Numbers Using Pointers
#include <stdio.h>

void swap(int *x, int *y) {
  int temp = *x;
  *x = *y;
  *y = temp;
}

int main() {
  int a, b;

  printf("Enter two numbers: ");
  scanf("%d %d", &a, &b);

  printf("Before swap: a = %d, b = %dn", a, b);

  swap(&a, &b);

  printf("After swap: a = %d, b = %dn", a, b);

  return 0;
}
📤 Output:
Input: 5 10
Output: Enter two numbers: Before swap: a = 5, b = 10
After swap: a = 10, b = 5

🔧 Pointers

💻 Toggle Case of Each Character
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main() {
    char str[100];
    int i;

    printf("Enter a string: ");
    fgets(str, sizeof(str), stdin);

    for (i = 0; str[i] != '0'; i++) {
        if (islower(str[i])) {
            str[i] = toupper(str[i]);
        } else if (isupper(str[i])) {
            str[i] = tolower(str[i]);
        }
    }

    printf("Toggled string: %s", str);

    return 0;
}
📤 Output:
Input: Hello World!
Output: Enter a string: Toggled string: hELLO wORLD!
Input: MiXeD CaSe
Output: Enter a string: Toggled string: mIxEd cAsE
Input: 123 abc ABC
Output: Enter a string: Toggled string: 123 abc abc
Input: Test_String
Output: Enter a string: Toggled string: tEST_sTRING
Input: a
Output: Enter a string: Toggled string: A
Input: A
Output: Enter a string: Toggled string: a
Input: This is a test string.
Output: Enter a string: Toggled string: tHIS IS A TEST STRING.
Input:
Output: Enter a string: Toggled string:

💻 Capitalize First Letter of Each Word
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main() {
    char str[100];
    int i;

    printf("Enter a string: ");
    fgets(str, sizeof(str), stdin);

    str[strcspn(str, "n")] = 0;

    if (strlen(str) > 0) {
        str[0] = toupper(str[0]);
    }

    for (i = 1; str[i] != '0'; i++) {
        if (str[i - 1] == ' ') {
            str[i] = toupper(str[i]);
        }
    }

    printf("Capitalized string: %sn", str);

    return 0;
}
📤 Output:
Input: hello world
Output: Capitalized string: Hello World

Input: this is a test
Output: Capitalized string: This Is A Test

Input: a very long string to test
Output: Capitalized string: A Very Long String To Test

Input: 123 abc
Output: Capitalized string: 123 Abc

Input:
Output: Capitalized string:

💻 Check if String Contains Only Alphabet
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main() {
    char str[100];
    int i, flag = 1;

    printf("Enter a string: ");
    scanf("%s", str);

    for (i = 0; str[i] != '0'; i++) {
        if (!isalpha(str[i])) {
            flag = 0;
            break;
        }
    }

    if (flag == 1) {
        printf("The string contains only alphabets.n");
    } else {
        printf("The string does not contain only alphabets.n");
    }

    return 0;
}
📤 Output:
Input: HelloWorld
Output: The string contains only alphabets.

Input: Hello123World
Output: The string does not contain only alphabets.

Input: AbCdEfGhIjKlMnOpQrStUvWxYz
Output: The string contains only alphabets.

Input: abcdefghijklmnopqrstuvwxyz
Output: The string contains only alphabets.

Input: 12345
Output: The string does not contain only alphabets.

Input: !@#$%^
Output: The string does not contain only alphabets.

Input: Hello World
Output: The string contains only alphabets.

💻 Check if String Contains Only Digits
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main() {
    char str[100];
    int i, is_digit_only = 1;

    printf("Enter a string: ");
    scanf("%s", str);

    for (i = 0; str[i] != '0'; i++) {
        if (!isdigit(str[i])) {
            is_digit_only = 0;
            break;
        }
    }

    if (is_digit_only) {
        printf("The string contains only digits.n");
    } else {
        printf("The string does not contain only digits.n");
    }

    return 0;
}
📤 Output:
Input: 12345
Output: The string contains only digits.

Input: abc123
Output: The string does not contain only digits.

Input: 9876
Output: The string contains only digits.

Input: 12.34
Output: The string does not contain only digits.

Input:
Output: The string contains only digits.

💻 Replace Character in String
// Code not available
📤 Output:
Because the code is not available, I cannot provide the output.