move exercises and lectures into subfolders

This commit is contained in:
2023-10-15 15:34:53 +01:00
parent 775b4bd643
commit 74092a17aa
177 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
#include <stdio.h>
#include <stdlib.h>
int main (void )
{
// Declare a in integer
int c,d;
// Declar and integer pointer
int *ptrC;
// Some assgnments
c = 10; // C now contains the value 10
ptrC = &c; // ptrC now 'Points' to c
// Get the value of c via the pointer and store in d
d = *ptrC; // d now contains 10
printf ("\nThe value in d is %d", d);
// Change the value of c via the pointer ptrC
*ptrC = 1; //c now contains 1
printf ("\nThe value in c is %d", c);
return 0; // exit
}

View File

@@ -0,0 +1,24 @@
#include <stdio.h>
#include <stdlib.h>
int main (void )
{
// Integer variables
int a, ValueB, d;
// integer pointers
int *ptrA=&a, *B=&ValueB, *Data=&d;
// Float variables
float f,y,z;
// Float pointers
float *pf=&f , *q=&y, *Zvalue=&z;
// We could also do this on separate lines e.g.
int SomeData;
int *Another;
Another = &SomeData;
return 0;
}

27
Exercises/C13/ex2.c Normal file
View File

@@ -0,0 +1,27 @@
#include <stdio.h>
#include <stdlib.h>
int main (void )
{
// Declare a in integer
int c,d;
// Declar and integer pointer
int *ptrC;
// Some assgnments
c = 10; // C now contains the value 10
ptrC = &c; // ptrC now 'Points' to c
*ptrC = 20;
// Get the value of c via the pointer and store in d
d = *ptrC; // d now contains 10
printf ("The value in d is %d\n", d);
// Change the value of c via the pointer ptrC
*ptrC = 1; //c now contains 1
printf ("The value in c is %d\n", c);
return 0; // exit
}

27
Exercises/C13/ex3.c Normal file
View File

@@ -0,0 +1,27 @@
#include <stdio.h>
#include <stdlib.h>
int main (void )
{
// Declare a in integer
float c,d;
// Declar and integer pointer
float *ptrC;
// Some assgnments
c = 10; // C now contains the value 10
ptrC = &c; // ptrC now 'Points' to c
*ptrC = 20;
// Get the value of c via the pointer and store in d
d = *ptrC; // d now contains 10
printf ("The value in d is %f\n", d);
// Change the value of c via the pointer ptrC
*ptrC = 1; //c now contains 1
printf ("The value in c is %f\n", c);
return 0; // exit
}