A
@Adarsh222
integer to string
#include <stdio.h>
#include <stdlib.h>
int main() {
// Declare a string to store the formatted output
char str[10];
// Convert the integer 123 to a string
sprintf(str, "%d", 123);
Why we send char pointers in a function but not only charters
In C, a character is a single byte, and a character pointer (char *) is a pointer
to a single byte in memory. When you pass a character pointer to a function, you
are passing a reference to the memory location of the character, rather than the
character itself.
There are several reasons why you might pass a character pointer rather than a
character to a function:
Modifying the character: By passing a character pointer to a function, you can
modify the character in memory through the
Funtion pointer pgm **
#include<stdio.h>
#include<string.h>
typedef int (*fnptr)(int,int);
typedef char (*cptr)(char*,char*);
int add(int a,int b){
int sum;
sum=a+b;
return sum;
Comparision between all sort pgms
https://www.geeksforgeeks.org/comparison-among-bubble-sort-selection-sort-and-insertion-sort/
Bubble sort
//https://www.geeksforgeeks.org/bubble-sort/
#include <stdio.h>
int main() {
int a[10];
int n;
printf("enter the no of digits :- ");
scanf("%d\n",&n);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
Bubble sort
//https://www.geeksforgeeks.org/bubble-sort/
#include <stdio.h>
int main() {
int a[10];
int n;
printf("enter the no of digits :- ");
scanf("%d\n",&n);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
Memory allocation for array stored
In C and C++, arrays can be stored in different areas of memory depending on
their storage class and whether they are defined inside or outside a function.
If an array has automatic storage class (also known as local variables), it is
stored on the stack. The stack is a portion of memory used for storing local
variables and function call data. When a function is called, the arguments and
local variables of the function are pushed onto the stack. When the function
returns, the data is
Memory allocation for struct stored
Structure
In C and C++, structure variables can be stored in different areas of memory,
depending on their storage class.
If a structure variable has automatic storage class (also known as local variables),
it is stored on the stack. The stack is a portion of memory used for storing local
variables and function call data. When a function is called, the arguments and
local variables of the function are pushed onto the stack. When the function
returns, the data is popped off the stack. Automa
Insertion sort
// C program for insertion sort
#include <math.h>
#include <stdio.h>
/* Function to sort an array using insertion sort*/
void insertionSort(int arr[], int n)
{
int i, key, j;
for (i = 1; i < n; i++) {
key = arr[i];// big one//k=1
imp interview algorithms
https://www.geeksforgeeks.org/top-10-algorithms-in-interview-questions/
https://www.geeksforgeeks.org/selection-sort/
open disk.h
/****************************************************************
* Project TCAM2
* (c) copyright 2022
* Company Harman International(India) Pvt. Ltd.
* All rights reserved
* Secrecy Level STRICTLY CONFIDENTIAL
****************************************************************/
/**
* @file opendisk.h
* @ingroup Security & Intelligent Systems
open disk
/****************************************************************
* Project TCAM2
* (c) copyright 2022
* Company Harman International(India) Pvt. Ltd.
* All rights reserved
* Secrecy Level STRICTLY CONFIDENTIAL
****************************************************************/
/**
* @file opendisk.c
* @ingroup Security & Intelligent Systems
Telimatics Cybersecurity
The telematics control unit is in a similar situation in terms of cyber-threats
and possible attack vectors, because the TCU serves as a gateway between the external
world and the IVN.
Vulnerable on two fronts, it can be attacked via both the external cellular
network and the in-vehicle network. A full transition to the use of automotive
Ethernet, using IP (internet protocol), increases the risk of a remote attack being
launched against an electronic control unit (ECU).
https://www.
Telimatics
What is a Telematics Control Unit?
In the automotive industry, a telematics control unit (TCU) is an embedded device
onboard a car that wirelessly links the vehicle to cloud storage or other vehicles
through V2X standards over a mobile network. The Telematics Control Unit collects
telematics data from the car,
such as location, speed, engine data, connection quality, and so on, by
connecting with various subsystems in the vehicle via data and control buses.
It may also offer in-veh
Cryptography and its Types
https://www.geeksforgeeks.org/cryptography-and-its-types/
Cryptography is technique of securing information and communications through use
of codes so that only those person for whom the information is intended can
understand it and process it. Thus preventing unauthorized access to information.
The prefix “crypt” means “hidden” and suffix graphy means “writing”.
In Cryptography the techniques which are use to protect information are obtained
from mathematical concepts and a set of rule base
Memory Layout of C Programs
//https://www.geeksforgeeks.org/memory-layout-of-c-program/
//https://www.scaler.com/topics/c/memory-layout-in-c/
After compiling a C program, a binary executable file(.exe) is created, and when we
execute the program, this binary file loads into RAM in an organized manner.
After being loaded into the RAM, memory layout in C Program has six components
which are text segment, initialized data segment, uninitialized data segment,
command-line arguments, stack, and heap. Each of these six
Storage classes
//https://www.geeksforgeeks.org/storage-classes-in-c/
Storage Classes are used to describe the features of a variable/function.
These features basically include the scope, visibility and life-time which help us
to trace the existence of a particular variable during the runtime of a program.
C language uses 4 storage classes, namely:
Efficient way of char input if string size is not known
#include <stdio.h>
#include<stdlib.h>
#if 0
int main() {//string input
char *a;
a=(char*)malloc(sizeof(char));
scanf("%s",a);
printf("%s",a);
free(a);
How do char[] and char * differ?
vimp
There are some differences. The s[] is an array, but *s is a pointer.
For an example, if two declarations are like char s[20], and char *s respectively,
then by using sizeof() we will get 20, and 4.
The first one will be 20 as it is showing that there are 20 bytes of data.
But second one is showing only 4 as this is the size of one pointer variable.
For the array, the total string is stored in the stack section,
but for the pointer, the pointer variable is stored into stack secti
Pre-increment and Post-increment in C/C++
In C/C++, Increment operators are used to increase the value of a variable by 1.
This operator is represented by the ++ symbol. The increment operator can either
increase the value of the variable by 1 before assigning it to the variable or can
increase the value of the variable by 1 after assigning the variable. Thus it can
be classified into two types:
Pre-Increment Operator
Post-Increment Operator
1) Pre-increment operator: A pre-increment operator is used to increment the value