A

@Adarsh222

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

C
3 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
3 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

strlen vs sizeof

C
3 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 charact

Reverse the array elements

C
3 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
3 years ago
#include <stdio.h> #include <stdio.h> struct BAC { int* n2; char c1; int n1; char* c2; };

Reverse the no

C
3 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
3 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
3 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.

Imp Bitwise taking the bit what we want from the whole

C
3 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 lastB

union allocation way

C
3 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
3 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
3 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

Imp Combined linkedlist pgm reverse and normal

C
3 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
3 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 i

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:

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