A

@Adarsh222

basic

C
3 years ago
/*diff between define and typedef Difference between typedef and #define: ->>>A macro is a piece of code in a program that is replaced by the value of the macro. Macro is defined by #define directive. Whenever a macro name is encountered by the compiler, it replaces the name with the definition of the macro. Macro definitions need not be terminated by a semi-colon(;). ->>>The typedef is a keyword that is used in C programming to provide existing

typedef enum

C
3 years ago
#include <stdio.h> #include <stdlib.h> #include <stdio.h> typedef enum { a1=49, a2 }name;

Types of pointers in c

C
3 years ago
Types of Pointers There are eight different types of pointers which are as follows − Null pointer Void pointer Wild pointer Dangling pointer

preprocessor and constant and Header

C
3 years ago
#define is is pre processor directive, no memory is allocated and it is not terminated with ";" const is allocated identifier size of memory in read only portion. Header file:- Header files help in reduction of repetitive code Correctly unselected Header files cannot have definitions of functions

*ptr[10] and (*ptr)[10] diff

C
3 years ago
#include <stdio.h> #if 0 int main(){ int (*ptr)[10]; int a[10]={99,1,2,3,4,5,6,7,8,9}; ptr=&a; printf("%d",(*ptr)[1]); } #endif

**p and *p[] diff

C
3 years ago
#include<stdio.h> void display(int n, char *str[]) { int i=0; while(i<n) printf("%s ",str[i++]); } int main() { display(1,"Hello"); return 0;

array and pointer diff

C
3 years ago
//#if 0 #include <stdio.h> int main() { const char *s = "geeksquizahhdcha"; printf("%lu", sizeof(s)); printf("\n%c", s[1]); return 0; }

harman basics

C
3 years ago
https://provenrun.com/services/security-engineering/ https://provenrun.com/products/provencore/

Time complexity

C
3 years ago
https://www.geeksforgeeks.org/understanding-time-complexity-simple-examples/#:~:text=So%2C%20the%20time%20complexity%20is,C The Time Complexity of an algorithm/code is not equal to the actual time required to execute a particular code, but the number of times a statement executes. Instead of measuring actual time required in executing each statement in the code, Time Complexity considers how many times each statement executes. Q. Imagine a classroom of 100 students in which you gav

Without semicolon print 1-10

C
3 years ago
#include <stdio.h> #define N 10 int main(int i) { while(i<=N && printf("%d",i) && i++){ } } always while ++ -- like puzzles the value will be treted from right to left

Pointer to constant

C
3 years ago
/* See following declarations to know the difference between constant pointer and a pointer to a constant. int * const ptr —> ptr is constant pointer. You can change the value at the location pointed by pointer p, but you can not change p to point to other location. int const * ptr —> ptr is a pointer to a constant. You can change ptr to point other variable. But you cannot change the value pointed by ptr. Therefore above program works well because we have a constant pointer and we are not

static

C
3 years ago
/* Static variables have a property of preserving their value even after they are out of their scope! Hence, static variables preserve their previous value in their previous scope and are not initialized again in the new scope. Following are some interesting facts about static variables in C.

Extern

C
3 years ago
#if 0 #include <stdio.h> extern int a; // int var; -> declaration and defination // extern int var; -> declaration /* Here, an integer type variable called var has been declared (it hasn’t been defined yet, so no memory allocation for var so far).

pointer to an array

C
3 years ago
#include<stdio.h> int main() { int arr[5] = { 1, 2, 3, 4, 5 }; int *ptr = arr; printf("%d\n", *ptr); printf("%p\n", ptr); return 0;

size of pointer

C
3 years ago
the size of a char pointer in a 32-bit processor is 4 bytes, while the size of a char pointer in a 64-bit processor is 8 bytes. 1) no matter char variable, int, float all size are same 0x0A etc. the size of the character pointer is 8 bytes. Note: This code is executed on a 64-bit processor. 2) Array

array basics

C
3 years ago
Pretty Simple program.. huh… Output will be 0. Now if you replace arr[0] with 0[arr], the output would be same. Because compiler converts the array operation in pointers before accessing the array elements. e.g. arr[0] would be *(arr + 0) and therefore 0[arr] would be *(0 + arr) and you know that both *(arr + 0) and *(0 + arr) are same.

Pointer to integer or char basics

C
3 years ago
#include <stdio.h> #if 0 int fun(int *p) { int n=10; int *q = &n; // char to pointer is different p = q; // pointer to pointer so the q value can be copied printf("%d",*p); // the pointer value cannot be passed to the main

exit(0)

C
3 years ago
#include <stdio.h> #include <stdlib.h> // Driver Code int main(void) { printf("START"); exit(1);//or exit(0) both are same // The program is terminated here

Static function

C
3 years ago
#include <stdio.h> /* In C, functions are global by default. The “static” keyword before a function name makes it static. For example, below function fun() is static. */ static int fun(void){ printf("I am a static function ");

Function basics

C
3 years ago
#include <stdio.h> int addNumbers(int a, int b); // function prototype /* The Function prototype serves the following purposes – 1) It tells the return type of the data that the function will return. 2) It tells the number of arguments passed to the function. 3) It tells the data types of each of the passed arguments.