A

@Adarsh222

IMP Take 1 byte input and check the no on 1s

C
2 years ago
#include <stdio.h> int main() { char data = 0x21; //0010 0001 //char or int same int count; int i = 2; //while doing bellow copy tha data value for further use int cp = data;

Hexadecimal to Binary

C
2 years ago
In hexadecimal notation, the letter "F" represents the decimal value 15. Decimal Binary Hexadecimal 15 1111 F ------------------------------------------------------------------------------------------ The correct binary representation of the hexadecimal value 0x20 is 0010 0000. Let me explain the conversion process step by step:

strlen vs sizeof

C
2 years ago
Sure! In C, strlen and sizeof are both functions used to determine the size of data, but they work in different ways. strlen is used to find the length of a string, which means the number of characters in the string excluding the null character ('\0') at the end. It calculates the length by counting each character until it reaches the null character. For example, the length of the string "Hello" is 5. sizeof, on the other hand, is an operator that determines the size in bytes of a

Reverse the array elements

C
2 years ago
#include <stdio.h> #include <string.h> void reverseArray(int arr[], int size) { int start = 0; int end = size - 1; while (start < end) { // Swap elements at start and end int temp = arr[start];

Size of pointer

C
2 years ago
#include <stdio.h> #include <stdio.h> struct BAC { int* n2; char c1; int n1; char* c2; };

Reverse the no

C
2 years ago
#include <stdio.h> int reverseNumber(int num) { int reversedNum = 0; while (num != 0) { reversedNum = reversedNum * 10 + num % 10; num /= 10; }

bitwise add char in int

C
2 years ago
#include <stdio.h> #if 1 int main() { char a = 'h'; char b = 'a'; int result = (a << 8) + b; //00010010<<00000000 + b0

Linkedlist vs Array

C
2 years ago
Memory Storage: Arrays store elements in contiguous memory, while linked lists use scattered memory nodes. Insertion and Deletion: Linked lists are more efficient for inserting and deleting elements, while arrays require shifting elements. Access and Random Access: Arrays allow for efficient random access using indices, while linked lists require traversing from the beginning. Dynamic Size: Arrays have a fixed size, while linked lists can dynamically

Imp Bitwise taking the bit what we want from the whole

C
2 years ago
#include <stdio.h> int main() { unsigned int binaryValue = 0b01011; // Example binary value //here we do calculte the last bit from a value 1 0r 0 //00001 means 1 when we & it with our value we comare the last bits value int lastBit = (binaryValue >> 4) & 1; //1&1=1 others all 0 so we store only the last value into and the we //will right shift

union allocation way

C
2 years ago
#include <stdio.h> union new { char c; int i; }; int main() { union new data;

An address 0x83 contains struct string values.. how can we access it

C
2 years ago
#include <stdio.h> struct new { char name[20]; char id[4]; }; int main() { struct new *ptr = (struct new*)0x83; // Corrected typo conersion

use cases of union

C
2 years ago
Unions are used when you want to store different types of data in the same memory location. They help save memory by allowing multiple variables to share the same space. For example, imagine you have a variable that can hold either an integer, a floating-point number, or a character. Instead of using separate variables for each type, you can use a union. The union will allocate memory that is large enough to hold the largest member, and you can then store values of different types

Imp Combined linkedlist pgm reverse and normal

C
2 years ago
#include <stdio.h> #include <stdlib.h> struct node{ int data; struct node *next; }; int main(){ struct node *a=NULL;

factorial of a positive integer

C
2 years ago
/*Recursion is a programming technique where a function calls itself either directly or indirectly. It involves breaking down a larger problem into smaller, more manageable subproblems until a base case is reached.*/ #include <stdio.h> unsigned int factorial(unsigned int n) { if (n == 0) return 1; else

find the maximum sum subarray in an array

C
3 years ago
#include <stdio.h> int maxSubarraySum(int arr[], int size) { int maxSum = arr[0]; int currentSum = arr[0]; for (int i = 1; i < size; i++) { if (currentSum < 0) currentSum = arr[i]; else

Single linked list with 2 variables many values store

C
3 years ago
#include <stdio.h> #include <stdlib.h> struct Node { int data; struct Node *next; }; void headpt(struct Node *head) { struct Node *tmp = head;

BITBAKE

C
3 years ago
In a BitBake recipe file (.bb), there are a few mandatory fields and variables that need to be included. These essential components provide metadata and define the recipe's behavior. Here are the mandatory items typically found in a .bb file: Recipe Information: SUMMARY: A brief description of the recipe. DESCRIPTION: A detailed description of the recipe. LICENSE: The license under which the recipe is distributed.

Check if from stating with bit is 1 && total no of 1's imp

C
3 years ago
#include <stdio.h> int main() { int a = 10; // 1010 int count = 0; int temp_a = a; // Create a copy of 'a' while (temp_a) { if (temp_a & 1) {

Strcat imp one

C
3 years ago
#include <stdio.h> #include <string.h> char *strrcat(char *str, char *sub){ while(*str!='\0'){ *str++; } while(*sub!='\0'){ *str = *sub; *str++;

While loop for str IMP

C
3 years ago
char *str = "Hello"; while (str) { printf("%c\n", *str); str++; } str is array pointer!!! Here at last (!= Null) gets value of pointer to compare Pointer value will always have some value