A

@Adarsh222

Union

C
3 years ago
#include <stdio.h> union example { int integer; float floating_point; char character; }; int main() { union example my_union;

indirect recursion

C
3 years ago
#include <stdio.h> int odd(); int num = 1; void even(){ if(num<=10) { printf("even no = %d\n", num-1); num++; odd();

REcursion

C
3 years ago
#include <stdio.h> void countDown(int n) { if (n <= 0) { printf("Countdown complete!\n"); } else { printf("%d\n", n); countDown(n - 1); // Recursive call } }

Unsigned and signed

C
3 years ago
#include <stdio.h> int main() { int signedInt = -10; unsigned int unsignedInt = 10;// or uint32_t printf("Signed int: %d\n", signedInt); printf("Unsigned int: %u\n", unsignedInt); unsignedInt = -10;

Difference between Priority Inversion and Priority Inheritance

C
3 years ago
In one line, Priority Inversion is a problem while Priority Inheritance is a solution. Priority Inversion means that the priority of tasks gets inverted and Priority Inheritance means that the priority of tasks gets inherited. Both of these phenomen

RTOS SEMA VS MUTEX SIMPLE WORDS

C
3 years ago
In simple terms, a mutex and a semaphore are both mechanisms used to control access to shared resources in concurrent programs, but they differ in their usage and behavior. A mutex (short for "mutual exclusion") is a lock that allows only one

CAllback uses and def

C
3 years ago
it notifies the main code when its done this gives more reuasability of code because the 1st function can be costomised without modifying the second function A callback function is a function that is passed as an argument to another function

Call Back ex in c

C
3 years ago
#include <stdio.h> #if 0 void print_hello() { printf("Hello, world!\n"); } void call_function(void (*function)()) { (*function)(); }

INLINE BASICS

C
3 years ago
In C programming language, the inline keyword is used to suggest the compiler to replace the function call with the function's code during the compilation process. This can improve the performance of the program by reducing the overhead of function

Reverse linked list

C
3 years ago
#include<stdio.h> #include<stdlib.h> struct Node{ int data; struct Node *next; }; static int count = 0;

using *ptr diam array

C
3 years ago
#include <stdio.h> void change_values(int **p, int rows, int cols) { int i, j; int *ptr; for (i = 0; i < rows; i++) { for (j = 0; j < cols; j++) { ptr = *(p + i) + j; *ptr = i * j; (*

**p is a double pointer, which is a pointer to a pointer.

C
3 years ago
#include <stdio.h> #include <stdlib.h> int main() { int rows = 3, cols = 4; int i, j; int **p = (int **)malloc(rows * sizeof(int *)); // allocate memory for rows // allocate memory for columns for (i = 0; i < rows; i++

Typecasting Pointer

C
3 years ago
#include <stdio.h> int main() { int x = 42; int *p = &x; printf("The value of x is: %d\n", x); printf("The value of *p is: %d\n", *p); printf("The value of p is: %p\n", (void *)p); printf("The address of x is: %p\n",

remove the particular integer from an array

C
3 years ago
#include <stdio.h> int main(){ int a[10] = {0}; int k=0; for(int i=0;i<6;i++){ scanf("%d",&a[i]); }

Program to remove the duplicate element in an array

C
3 years ago
#include <stdio.h> #include <string.h> int main() { int a[10] = {0}; int m = 0; for(int i=0;i<6;i++){ scanf("%d",&a[i]); }

sizeof()

C
3 years ago
#include <stdio.h> size_t sizeof_func(const void *ptr); int main() { int x = 10; size_t size = sizeof_func(&x); printf("The size of x is %zu bytes\n", size); return 0; }

strlen

C
3 years ago
#include <stdio.h> #define pointer //#define array size_t my_strlen(const char* str) { #ifdef pointer size_t length = 0; while (*str != '\0') { length++;

strcmp

C
3 years ago
#include <stdio.h> int strrcmp(char *str, char *sub){ while(*str!='\0'){ if(*str==*sub){ *str++; *sub++; } else{ return 1;

Strcpy

C
3 years ago
#include <stdio.h> char* strcpy(char* dest, const char* src) {//we use this to retun statements for str while (*src != '\0') {//we use * for dereferece pointer to char to copy char insted of address *dest = *src; dest++;

union ex

C
3 years ago
#include <stdio.h> #include <string.h> union data { int i; float f; char str[20];//largest is 20 }; int main() {