A

@Adarsh222

imp

C
3 years ago
Task - Its an unit of execution(function) for a program these are sheduled by RTOS on diff diff priority order What is a critical section in an RTOS and how is it protected? A critical section is a part of code in an RTOS where a shared resource is

Typecasting

C
3 years ago
/* Typecasting in C allows you to convert a value of one data type to another data type. Here's an example program that demonstrates typecasting: */ #include <stdio.h> int main() { double x = 3.14159; int y = (int) x; // Typecasti

Operators

C
3 years ago
#include <stdio.h> #include <stdbool.h> int main() { // Arithmetic Operators int x = 10; int y = 5; int sum = x + y; // Addition int difference = x - y; // Subtraction int product = x * y; // Multiplication

Advance is we cannot take size from user and cannot determine size

C
3 years ago
#include <stdio.h> #include <stdlib.h> int main() { int capacity = 5; // initial capacity int size = 0; // current number of elements int *arr = malloc(sizeof(int) * capacity); int num; while (scanf("%d", &num) == 1) {

doubly linked list

C
3 years ago
#include <stdio.h> #include <stdlib.h> struct Node { int data; struct Node *prev; struct Node *next; }; void insertAtEnd(struct Node **head, int value) {

struct size

C
3 years ago
struct Person { char name[20]; int age; float height; };//int32_t Example 1: c Copy code

what is dead lock

C
3 years ago
A deadlock is a situation that can occur in a computer system where two or more processes are blocked, unable to proceed because they are waiting for each other to release resources. Imagine two people are each holding a key to a different door, bu

Rtos vs Linux

C
3 years ago
RTOS (Real-Time Operating System) and Linux are two different types of operating systems with different characteristics and use cases. Here are some key differences between the two: Real-time performance: RTOS is designed to provide determinis

what is the normal boot sequence frm powerup of your rtos or linux

C
3 years ago
The normal boot sequence for an RTOS (Real-Time Operating System) or Linux can vary depending on the specific system and configuration, but here is a general overview of the process: Power on: When the system is powered on, the hardware initia

how a system works in linux

C
3 years ago
A Linux system is made up of several components that work together to provide a functional and usable operating system. Here is a brief overview of some of the key components and how they work: Kernel: The Linux kernel is the core of the opera

Mutex vs Semaphore

C
3 years ago
Both mutexes and semaphores are mechanisms used to coordinate access to shared resources in a concurrent programming environment. A mutex (short for mutual exclusion) is a synchronization object used to ensure that only one thread at a time e

Process vs Thread

C
3 years ago
In simple terms, a process is like a program running on your computer, while a thread is like a task within that program. A process has its own memory space, system resources, and can run independently of other processes. Each process can have

isspace() ispuncht()

C
3 years ago
#include <stdio.h> #include <ctype.h> int main() { char c = ' '; if (isspace(c)) { printf("The character is a whitespace character.\n"); } else { printf("The character is not a whitespace character.\n"); }

static keyword

C
3 years ago
#include <stdio.h> void increment() { static int count = 0; count++; printf("Count is %d\n", count); } void use_increment() { increment();

volatile keyword

C
3 years ago
#include <stdio.h> int main() { volatile int x = 10; while (x == 10) { printf("x is %d\n", x); } return 0; }

Find substring: You may be asked to write code to find the first occurrence of a given substring

C
3 years ago
#include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> int main(){ char *str = NULL; char *sub = NULL; size_t lent = 256;

imp remove the white space between char

C
3 years ago
#include <stdio.h> #include <string.h> int main() { char a[20]; scanf("%[^\n]",a);//note if(scanf("%d",a)==1) will not work for array int len = strlen(a); for(int i;i<len-1;i++){ if(a[i]==' '){// if only i then only 1 s

IMP reverses the words in a sentence

C
3 years ago
#include<stdio.h> #include<string.h> #include<stdlib.h> int main(){ char *str=NULL; size_t length = 0; if(getline(&str,&length,stdin) == -1){//only use for till /n new line input printf("no input");

IMP Write a function that takes a string as input and returns the reverse of that string

C
3 years ago
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ char a[] = "adarsh"; int len = sizeof(a)/sizeof(a[0]) - 1; // subtract 1 to exclude null terminator printf("%d\n", len);//scanf only no getline /*IMP we nee

imp Counting Set Bits

C
3 years ago
#include <stdio.h> int main(){ int a = 10; //1010 a = a | (1<<0); printf("%d\n",a); a = a & ~(1<<0); printf("%d\n",a);