Fixed all those make files
parent
743f5d215d
commit
46f0946e62
@ -0,0 +1,12 @@
|
||||
.PHONY: clean
|
||||
P=erf
|
||||
OBJECTS= erf.o
|
||||
CFLAGS = -g -Wall -O3
|
||||
LDLIBS=''
|
||||
CC=gcc
|
||||
|
||||
$(P): $(OBJECTS)
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o $(P)
|
Binary file not shown.
@ -0,0 +1,6 @@
|
||||
CLEANSUBDIRS ?= types structs static pointers hello headers functions file_io env_vars
|
||||
|
||||
cleanall:
|
||||
@for subdir in $(CLEANSUBDIRS); do \
|
||||
(cd $$subdir && $(MAKE) clean) || exit 1; \
|
||||
done
|
@ -1,7 +1,11 @@
|
||||
P=
|
||||
P=env
|
||||
OBJECTS=
|
||||
CFLAGS = -g -Wall -O3
|
||||
LDLIBS=
|
||||
CC=gcc
|
||||
|
||||
$(P): $(OBJECTS)
|
||||
|
||||
clean:
|
||||
rm -f *.o $(P)
|
||||
rm -rf env.dSYM/
|
Binary file not shown.
@ -1,14 +1,18 @@
|
||||
#include <stdlib.h> //getenv, atoi
|
||||
#include <stdio.h> //printf
|
||||
|
||||
int main(){
|
||||
int main()
|
||||
{
|
||||
// pointer to a char
|
||||
char *repstext=getenv("reps");
|
||||
char *repstext = getenv("reps");
|
||||
// atoi reads in the string and converts it to a integer value.
|
||||
// This is the tenary operator 'condition ? value_if_true : value_if_false'
|
||||
int reps = repstext ? atoi(repstext) : 10;
|
||||
|
||||
char *msg = getenv("msg");
|
||||
if (!msg) msg = "Hello.";
|
||||
if (!msg)
|
||||
msg = "Hello.";
|
||||
|
||||
for (int i=0; i< reps; i++)
|
||||
for (int i = 0; i < reps; i++)
|
||||
printf("%s\n", msg);
|
||||
}
|
||||
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
Margot,517-775-7040
|
|
@ -0,0 +1,12 @@
|
||||
.PHONY: clean
|
||||
P=cube
|
||||
OBJECTS= cube.o
|
||||
CFLAGS = -g -Wall -O3
|
||||
LDLIBS=''
|
||||
CC=gcc
|
||||
|
||||
$(P): $(OBJECTS)
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o $(P)
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,33 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#define DOLLARS 0x24;
|
||||
|
||||
// Example of function declaration. This is what the preprocessor does with the header files
|
||||
void set_to_y(char *p);
|
||||
|
||||
int main()
|
||||
{
|
||||
char my_char = 'a';
|
||||
char *p_char;
|
||||
|
||||
p_char = &my_char;
|
||||
|
||||
printf("The value of *p_char is set to %c\n", *p_char);
|
||||
set_to_y(p_char);
|
||||
|
||||
printf("Lets check the value of my_char: %c\n", my_char);
|
||||
printf("You, know what I want to just muck with your memory directly\n");
|
||||
|
||||
//derefence the location and just set the byte we want
|
||||
*p_char = DOLLARS;
|
||||
printf("So all your bits now should show my_char as $ DOLLARS. Lets see: %c\n", my_char);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This is function definition
|
||||
void set_to_y(char *p)
|
||||
{
|
||||
fprintf(stdout, "Setting the value at address %p from %c to y\n", &p, *p);
|
||||
*p = 'y';
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
.PHONY: clean
|
||||
P=types
|
||||
OBJECTS= types.o
|
||||
CFLAGS = -g -Wall -O3
|
||||
LDLIBS=''
|
||||
CC=gcc
|
||||
|
||||
$(P): $(OBJECTS)
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o $(P)
|
Loading…
Reference in New Issue