C Programming Language || Hands On Coding
Hands-on C programming language challenges for beginners. Learn building logic by solving programs. Owner: @Pradeep_saii
Ko'proq ko'rsatish📈 Telegram kanali C Programming Language || Hands On Coding analitikasi
C Programming Language || Hands On Coding (@c_programming_language_coding) Ingliz til segmentidagi kanali faol ishtirokchi. Hozirda hamjamiyat 12 822 obunachidan iborat bo'lib, Texnologiyalar & Aralashmalar toifasida 9 562-o'rinni va Hindiston mintaqasida 31 207-o'rinni egallagan.
📊 Auditoriya ko‘rsatkichlari va dinamika
невідомо sanasidan buyon loyiha tez o‘sib, 12 822 obunachiga ega bo‘ldi.
26 Avgust, 2026 dagi oxirgi ma’lumotlarga ko‘ra kanal barqaror faollikka ega. Oxirgi 30 kunda obunachilar soni -210 ga, so‘nggi 24 soatda esa -2 ga o‘zgardi va umumiy qamrov yuqori darajada qolmoqda.
- Tasdiqlash holati: Tasdiqlanmagan
- Jalb etish (ER): Auditoriya o‘rtacha 12.56% darajada jalb etiladi. Nashrdan keyingi dastlabki 24 soatda kontent odatda umumiy obunachilar sonining 2.42% ini tashkil etuvchi reaksiyalarni to‘playdi.
- Post qamrovi: Har bir post o‘rtacha 1 612 marta ko‘riladi; birinchi sutkada odatda 310 ta ko‘rish yig‘iladi.
- Reaksiyalar va o‘zaro ta’sir: Auditoriya faol: har bir postga o‘rtacha 4 ta reaksiya keladi.
- Tematik yo‘nalishlar: Kontent input, string, scanf("%d, array, element kabi asosiy mavzularga jamlangan.
📝 Tavsif va kontent siyosati
Muallif resursni shaxsiy fikrni ifoda etish maydoni sifatida ta’riflaydi:
“Hands-on C programming language challenges for beginners. Learn building logic by solving programs.
Owner: @Pradeep_saii”
Yuqori yangilanish chastotasi (oxirgi ma’lumot 27 Avgust, 2026 da olingan) sababli kanal doimo dolzarb va katta qamrovli bo‘lib qoladi. Analitika auditoriya kontent bilan faol hamkorlik qilishini, uni Texnologiyalar & Aralashmalar toifasidagi muhim ta’sir nuqtasiga aylantirishini ko‘rsatadi.
#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
#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.
#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.
#include <stdio.h>
int main() {
int num = 10;
int *ptr = #
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
#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
#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
#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.
#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
#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
#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
#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
#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
#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
#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
#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:
#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:
#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.
#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.
// Code not available
📤 Output:
Because the code is not available, I cannot provide the output.
