The document provides lecture notes on C programming concepts including arrays, control statements, pointers, functions, and dynamic memory allocation. It defines arrays as fixed-size collections that store elements of the same type in contiguous memory locations. Control statements covered include for, while, do-while loops, and break and continue keywords. Pointers are explained as variables that store memory addresses and are used for call by reference with functions. Function prototypes, definitions, and calling conventions are demonstrated. Finally, pointers to functions are shown as allowing functions to be passed as parameters to other functions.
Pointers are among C’s most powerful, yet most difficult concepts to master. Some tasks like dynamic memory allocation done only by using pointers. So it is essential to learn pointers.
Pointers are a type of variable, just like int, double, etc., except instead of storing a value, they store a memory address of another variable.
Memory management is one of the most fundamental and important aspect for any computer programming language. In the dynamic memory allocation, the memory is allocated to a variable or program at the run time.
Pointers are among C’s most powerful, yet most difficult concepts to master. Some tasks like dynamic memory allocation done only by using pointers. So it is essential to learn pointers.
Pointers are a type of variable, just like int, double, etc., except instead of storing a value, they store a memory address of another variable.
Memory management is one of the most fundamental and important aspect for any computer programming language. In the dynamic memory allocation, the memory is allocated to a variable or program at the run time.
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language. This lecture series will give you basic concepts of structured programming language with C.
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language. This lecture series will give you basic concepts of structured programming language with C.
My slides for acamedia talk about embedded vision in 2010. Some of our research results are also presented in this presentation.
Few slides have chinese characters.
This lecture targets to install Ubuntu on a VM. It starts by describing some info about Virtualization Virtual Machines, followed by installation procedure. The lecture then goes through the UI of Ubuntu.
Check the other Lectures and courses in
http://Linux4EnbeddedSystems.com
or Follow our Facebook Group at
- Facebook: @LinuxforEmbeddedSystems
Lecturer Profile:
- https://www.linkedin.com/in/ahmedelarabawy
Intelligent Video Surveillance - Synesis integrated hardware and software sol...Nikolai Ptitsyn
Our end-to-end solution for security surveillance features HD (1080p, 720p) support, H.264 compression, ONVIF middleware, Linux SoC and reach video analytics. Bundled or third-party (xDIAS-compliant) analytical modules can be embedded in the edge device providing a better performance and scalability than server analytics. The available reference designs include ip-cameras, video encoders and DVRs.
In this Lab, we go through the steps to prepare the Raspberry Pi board for the projects in the course. this includes selecting the OS and setting it up on the SD card, connecting the Pi, and booting it.
The Lab also goes through setting up the network interfaces (both wired and wireless) and remote connecting into the Pi
Embedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi APAhmed El-Arabawy
In this Lab, we go through the steps to build a WiFi Access Point using the Raspberry Pi. The Lab starts by introducing some concepts of Wireless LANs followed by step-by-step procedure to build the AP. The Lab concludes by an evaluation of the performance of the built AP
Course 102: Lecture 16: Process Management (Part 2) Ahmed El-Arabawy
This lecture continues to introduce concepts about processes in Linux. It describes both Automatic processes and Daemon Processes.
Check the other Lectures and courses in
http://Linux4EnbeddedSystems.com
or Follow our Facebook Group at
- Facebook: @LinuxforEmbeddedSystems
Lecturer Profile:
- https://www.linkedin.com/in/ahmedelarabawy
Embedded Systems: Lecture 2: Introduction to Embedded SystemsAhmed El-Arabawy
This lecture provides an introduction to Embedded Systems and its applications. It also outlines some of the differences for developing embedded systems compared to traditional systems
Embedded Systems: Lecture 4: Selecting the Proper RTOSAhmed El-Arabawy
This lecture describes the different properties of Embedded Systems Operating Systems that would affect the selection of the most appropriate RTOS in an embedded system application
This lecture discusses the Environment Variables concept, usage, and how processes acquire them. It then goes through the most popular ones
Check the other Lectures and courses in
http://Linux4EnbeddedSystems.com
or Follow our Facebook Group at
- Facebook: @LinuxforEmbeddedSystems
Lecturer Profile:
- https://www.linkedin.com/in/ahmedelarabawy
This lecture is the first part of an introduction to SVC tools with a focus on Git and GitHub. This Lecture discusses the basic concepts as well as Installation and initial configuration of Git
This lecture describes the virtual filesystems procfs and sysfs.
Video for this Lecture on youtube:
http://www.youtube.com/watch?v=wlxL-iQN6No
Check the other Lectures and courses in
http://Linux4EnbeddedSystems.com
or Follow our Facebook Group at
- Facebook: @LinuxforEmbeddedSystems
Lecturer Profile:
Ahmed ElArabawy
- https://www.linkedin.com/in/ahmedelarabawy
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
6th International Conference on Machine Learning & Applications (CMLA 2024)ClaraZara1
6th International Conference on Machine Learning & Applications (CMLA 2024) will provide an excellent international forum for sharing knowledge and results in theory, methodology and applications of on Machine Learning & Applications.
Online aptitude test management system project report.pdfKamal Acharya
The purpose of on-line aptitude test system is to take online test in an efficient manner and no time wasting for checking the paper. The main objective of on-line aptitude test system is to efficiently evaluate the candidate thoroughly through a fully automated system that not only saves lot of time but also gives fast results. For students they give papers according to their convenience and time and there is no need of using extra thing like paper, pen etc. This can be used in educational institutions as well as in corporate world. Can be used anywhere any time as it is a web based application (user Location doesn’t matter). No restriction that examiner has to be present when the candidate takes the test.
Every time when lecturers/professors need to conduct examinations they have to sit down think about the questions and then create a whole new set of questions for each and every exam. In some cases the professor may want to give an open book online exam that is the student can take the exam any time anywhere, but the student might have to answer the questions in a limited time period. The professor may want to change the sequence of questions for every student. The problem that a student has is whenever a date for the exam is declared the student has to take it and there is no way he can take it at some other time. This project will create an interface for the examiner to create and store questions in a repository. It will also create an interface for the student to take examinations at his convenience and the questions and/or exams may be timed. Thereby creating an application which can be used by examiners and examinee’s simultaneously.
Examination System is very useful for Teachers/Professors. As in the teaching profession, you are responsible for writing question papers. In the conventional method, you write the question paper on paper, keep question papers separate from answers and all this information you have to keep in a locker to avoid unauthorized access. Using the Examination System you can create a question paper and everything will be written to a single exam file in encrypted format. You can set the General and Administrator password to avoid unauthorized access to your question paper. Every time you start the examination, the program shuffles all the questions and selects them randomly from the database, which reduces the chances of memorizing the questions.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Understanding Inductive Bias in Machine LearningSUTEJAS
This presentation explores the concept of inductive bias in machine learning. It explains how algorithms come with built-in assumptions and preferences that guide the learning process. You'll learn about the different types of inductive bias and how they can impact the performance and generalizability of machine learning models.
The presentation also covers the positive and negative aspects of inductive bias, along with strategies for mitigating potential drawbacks. We'll explore examples of how bias manifests in algorithms like neural networks and decision trees.
By understanding inductive bias, you can gain valuable insights into how machine learning models work and make informed decisions when building and deploying them.
Using recycled concrete aggregates (RCA) for pavements is crucial to achieving sustainability. Implementing RCA for new pavement can minimize carbon footprint, conserve natural resources, reduce harmful emissions, and lower life cycle costs. Compared to natural aggregate (NA), RCA pavement has fewer comprehensive studies and sustainability assessments.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsVictor Morales
K8sGPT is a tool that analyzes and diagnoses Kubernetes clusters. This presentation was used to share the requirements and dependencies to deploy K8sGPT in a local environment.
HEAP SORT ILLUSTRATED WITH HEAPIFY, BUILD HEAP FOR DYNAMIC ARRAYS.
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where we first find the minimum element and place the minimum element at the beginning. Repeat the same process for the remaining elements.
4. 4
Arrays.
which can store a fixed-size sequential collection of elements of the
same type.
All arrays consist of contiguous memory locations (Single Block).
The size of array, once declared, is fixed and cannot be modified.
Single Dimension Array.
Multi Dimension Array (Array of Arrays).
EX:
char a[5]; //Array of 5 characters.
EX:
char a[3][4];
/*Array of three arrays
and each array has 4 characters.*/
5. 5
Examples:
double d[100]={1.5,2.7};
//first two elements initialized and remaining ones set to zero.
short num[]={1,2,3,4,5,6};
//compiler fixes size at 7 elements.
short num[]={1,2,3,4,5,6};
//compiler fixes size at 7 elements.
6. 6
Take Care !!!!
#define size 10
int a[size];
char size=10;
int a[size];
const char size=10;
int a[size];
int a[5.3];
//size must be an integer
int a[5];
a[5]=50;
//in this case it will overwrite some data.
a[-1]=5;
//the index must be an integer.
7. 7
Control Statements.
For Statements.
for (initial value;condition;update)
{
//statements
}
OR
initial value;
for(;condition;)
{
//statements
update;
}
8. 8
Take Care !!!!
char x;
for(x=0;x<200;x++)
{
printf(“c programming”);
}
for(;;)
{
printf(“c programming”);
}
9. 9
while loop.
while (condition)
{
//statements
}
do while loop.
do
{
//statements
}
while (condition)
Control Statements.
10. 10
Break & Continue.
• Break and continue are used to modify the execution of loops.
break.
When the break statement is encountered inside a loop, the loop is immediately
terminated and program control resumes at the next statement following the loop.
Continue.
continue forces the next iteration of the loop to take place, skipping
any code in between.
11. 11
Examples:
//program to print even numbers between(0:50)
int main()
{
char x=0;
while (x<=50)
{
if(x%2){
x++;
continue;
}
printf("%dn",x++);
}
return 0;
}
12. 12
Pointers.
Why pointers?
• Achieve call by reference with functions.
• Arrays and structures are difficult without pointers.
• Create linked list, trees and graph.
Note:
We must take care in using pointers since, there are no safety features.
13. 13
Declaring pointers.
• Pointers are declared using “*”.
Int x; //declaring an integer
Int* x; //declaring pointer to an integer
char* m; //declare pointer to character
Notes:
• Pointers may only point to variables of the same type as the pointer
has been declared.
• A pointer to an int may only point to int.
• A pointer to a double may only point to double not float or long double.
• (&) stands for “address of….”
• (*) stands for “content of…”
16. 16
Pointers and arrays.
• The name of array is a pointer to the 0th place of array.
• You cannot apply increment or decrement on array name.
• Pointer is useful for passing array to function and safe stack memory.
EX#1:
double *ptr;
double arr[10];
Ptr=arr; //ptr=&arr[0]
arr++; //not allowed
ptr++; //allowed
EX#2:
void print_arr(char *ptr){
printf(“%dn”,*(ptr++));
}
. . . . . . . . . . .
char arr[10];
Print_arr(arr);
Take Care !!!!
char *ptr[5]; //array of five pointers to char
char (*ptr)[5]; //pointer to array of 5 elements
18. 18
Functions.
• Functions are blocks of code that perform a number of pre-defined commands to
accomplish something productive. You can either use the built-in library functions
or you can create your own functions.
• Functions that a programmer writes will generally require a prototype.
• It tells the compiler what the function will return, what the function will be called,
as well as what arguments the function can be passed.
return-type <function-name> (arg_type arg1, arg_type arg2,…);
Exs.
void fun (void); //function which take nothing and return nothing
void fun (int x,int y,…); //function take arguments and return nothing
int fun (void); //function take nothing and return int
int fun (int x,int y,…); //function take arguments and return int
19. 19
Ex#1.
#include <stdio.h>
int mult ( int x, int y ); //prototype of function
int main()
{
int x,int y,int result;
printf( "Please input two numbers to be multiplied: " );
scanf( "%d", &x );
scanf( "%d", &y );
result= mult(x,y); //calling the function
printf( "The product of two numbers is %dn",result);
return 0;
}
//implementation of function
int mult (int x, int y)
{
return x * y;
}
Functions. cont‟d
Pointer to function.
20. 20
What happened in calling function?
Save some data in memory segment called stack.
• the value of PC (Program Counter).
• A copy of parameters passed to function.
• The value which returned from function.
Note:
If size of data stored on stack is larger than whole stack size it will cause
Common error called “Stack Overflow”.
Problem:
What if we need to pass a huge data to function to be processed.
Solution:
We can pass by reference because any pointer only occupy 4 bytes.
Functions. cont‟d
Calling function.
21. 21
Write a c program to calculate the largest number in passed array.
#include <studio.h>
char calc_largest (char *ptr,char siz)
{
char largest=*ptr;
char i=0;
for (i=0;i<siz;i++)
{
if (*(ptr+i) >largest)
largest=*(ptr+i);
else
continue;
}
return largest;
}
int main(){
char arr[]={45,12,5,44,6,8,60}
printf(“the largest value is %d”,calc_largest(arr,sizeof(arr));
}
Functions. cont‟d
22. 22
Functions. cont‟d
Pointer to function.
• Pointer to function allow programmers to pass a function as a
parameter to another function.
• Function pointer syntax.
<return data_type> (* pointer_name)(arguments passed to function);
EX#1:
void (*ptr)(int arg1,int arg2);
/*
Pointer to function which return nothing and take two
integers parameters.
*/
Note:
Don't be confused between pointer to function and pointer to array.
23. 23
Functions. cont‟d
Initializing Pointer to function.
EX#2:
void my_int_func(int x)
{
printf( "%dn", x );
}
int main()
{
void (*ptr)(int);
/* the ampersand is actually optional */
ptr = &my_int_func;
(*ptr)( 2 ); //or ptr(2);
return 0;
}