A

@Adarsh222

Difference between ++*p, *p++ and *++p

C
3 years ago
//https://www.geeksforgeeks.org/difference-between-p-p-and-p/ // PROGRAM 3 #include <stdio.h> int main(void) { int arr[] = {10, 20}; char a[]="hello"; int *p = arr; *++p;//*(++p)//so increments the next values

Precedence of postfix ++ and prefix ++ in

C
3 years ago
//https://www.geeksforgeeks.org/g-fact-59/ /* In C/C++, precedence of Prefix ++ (or Prefix –) has same priority than dereference (*) operator, and precedence of Postfix ++ (or Postfix –) is higher than both Prefix ++ and *. If p is a pointer then *p++ is equivalent to *(p++) and ++*p is equivalent to ++(*p) (both Prefix ++ and * are right associative). */

Return

C
3 years ago
/*https://www.geeksforgeeks.org/return-statement-in-c-cpp-with-examples/ The return statement returns the flow of the execution to the function from where it is called. This statement does not mandatorily need any conditional statements. As soon as the statement is executed, the flow of the program stops immediately and returns the control from where it was called. The return statement may or may not return anything for a void function, but for a non-void function, a retur

Return in switch

C
3 years ago
static uint32_t convertToMode(SECCRYPTOMGRCORE_OPERATION_MODE operationMode) { TEEC_OperationMode TEEC_Variable; switch (operationMode) { case SECCRYPTOMGRCORE_OPMODE_ENCRYPT: TEEC_Variable = TEEC_MODE_ENCRYPT; break; case SECCRYPTOMGRCORE_OPMODE_DECRYPT: TEEC_Variable = TEEC_MODE_DECRYPT;

How to avoid the structure padding

C
3 years ago
/* How to avoid the structure padding in C? The structural padding is an in-built process that is automatically done by the compiler. Sometimes it required to avoid the structure padding in C as it makes the size of the structure greater than the size of the structure members. We can avoid the structure padding in C in two ways: Using #pragma pack(1) directive

Structure Padding

C
3 years ago
#include <stdio.h> struct aa{ char a,b; //int c;// see the difference in padding char d,e; //int c;// see the difference in padding }; int main(){

End a string forcefully

C
3 years ago
//https://www.includehelp.com/c/find-output-of-c-programs-2.aspx //https://www.includehelp.com/c/find-output-of-c-programs-3.aspx #include <stdio.h> #include <string.h> int main() { char str[20] = "ABCDEFGHIJK"; int s = strlen(str);

Structure vs Union

C
3 years ago
What is Structure? Structure is a user-defined data type in C programming language that combines logically related data items of different data types together. All the structure elements are stored at contiguous memory locations. Structure type variable can store more than one data item of varying data types under one name. What is Union

struct imp basics

C
3 years ago
https://www.geeksforgeeks.org/structures-c/ Accessing Structure Members To access any member of a structure, we use the member access operator (.). The member access operator is coded as a period between the structure variable name and the structure member that we wish to access. You would use the keyword struct to define variables of structure type. The following example shows how to use a structure in a program

Array vs Linked list

C
3 years ago
https://www.geeksforgeeks.org/linked-list-vs-array/ Array: Arrays store elements in contiguous memory locations, resulting in easily calculable addresses for the elements stored and this allows faster access to an element at a specific index. Linked List: Linked lists are less rigid in their storage structure and elements are usually not stored in contiguous locations, hence they need to be stored with additional tags giving a reference to the next element.

Array vs Malloc and array[] means imp

C
3 years ago
There are several different pieces at play here. The first is the difference between declaring an array as int array[n]; and int* array = malloc(n * sizeof(int)); In the first version, you are declaring an object with automatic storage duration.

Strings LL

C
3 years ago
#include <stdio.h> #include <string.h> #include <stdlib.h> struct Node{ char *data; struct Node *next; int a; };

concat integers

C
3 years ago
// C program to concatenate // two integers into one #include <stdio.h> #include <string.h> #include <stdlib.h> //imp // Function to concatenate // two integers into one int concat(int a, int b)

Binary Search Iteration Pgm

C
3 years ago
#include <stdio.h> int binarysearch(int a[],int x,int low,int high){ while(low<=high){ int mid=low+(high-low)/2; if(a[mid]==x){ printf("%d",mid); } if(a[mid]<x){

Binary search working

C
3 years ago
https://www.programiz.com/dsa/binary-search Binary Search Working Binary Search Algorithm can be implemented in two ways which are discussed below. Iterative Method Recursive Method The recursive method follows the divide and conquer approach.

O notations MCQ

C
3 years ago
What is the time complexity of adding an item in front of a LinkedList? O(1) What is the time complexity of adding elements at the beginning of ArrayList? O(n) Indicate logarithm polynomial time complexity. O(n^const(const=2,3…) ) What is the time complexity of the insert(index) method in ArrayList?

Linear search vs Binary search

C
3 years ago
What is a linear search? A linear search is also known as a sequential search that simply scans each element at a time. Suppose we want to search an element in an array or list; we simply calculate its length and do not jump at any item. Complexity of Linear search:- As linear search scans each element one by one until the element is not found. If the number of elements increases, the number of elements to be scanned is also increased. We can say that the time taken to search the elem

Linear Search

C
3 years ago
//Time complexity: O(N) //Auxiliary Space: O(1) #include <stdio.h> int search(int arr[],int sz,int src){ for(int i=0;i<sz;i++){ if(arr[i]==src){ printf("%d",i); } }

Enum with string

C
3 years ago
#include <stdio.h> #include <string.h> enum a{sun,mon,tue,wed}; int main(){ enum a d; char da[10]; scanf("%s",da);

Bubble sort

C
3 years ago
#include <stdio.h> int main() { int arr[5]; for(int i = 0; i < 5; i++) { if(scanf("%d", &arr[i]) != 1) { printf("Failed to get input.\n"); return 1; }