repo update
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
/*
|
||||
void swap(int x, int y) {
|
||||
int temp = x;
|
||||
x = y;
|
||||
y = temp;
|
||||
}
|
||||
*/
|
||||
|
||||
void swap(int* x, int* y) {
|
||||
int temp = *x;
|
||||
*x = *y;
|
||||
*y = temp;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int A = 2;
|
||||
int B = 8;
|
||||
// Pass in addresses to be
|
||||
swap(&A,&B);
|
||||
cout << "A: " << A << " B: " << B << endl;
|
||||
|
||||
return 0;
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
/*
|
||||
void swap(int x, int y) {
|
||||
int temp = x;
|
||||
x = y;
|
||||
y = temp;
|
||||
}
|
||||
*/
|
||||
|
||||
void swap(int* x, int* y) {
|
||||
int temp = *x;
|
||||
*x = *y;
|
||||
*y = temp;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int A = 2;
|
||||
int B = 8;
|
||||
// Pass in addresses to be
|
||||
swap(&A,&B);
|
||||
cout << "A: " << A << " B: " << B << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
#makefile comment
|
||||
|
||||
CC = g++
|
||||
CFLAGS = -C
|
||||
LFLAGS =
|
||||
SOURCES = math.cpp main.cpp
|
||||
OBJECTS = $(SOURCES:.cpp=.o)
|
||||
EXECUTABLE = making_ex1
|
||||
|
||||
all: $(EXECUTABLE) $(SOURCES)
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS)
|
||||
$(CC) $(LFLAGS) -o $(EXECUTABLE) $(OBJECTS)
|
||||
|
||||
%.o:%.cpp
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
-include
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f $(EXECUTABLE)
|
||||
#makefile comment
|
||||
|
||||
CC = g++
|
||||
CFLAGS = -C
|
||||
LFLAGS =
|
||||
SOURCES = math.cpp main.cpp
|
||||
OBJECTS = $(SOURCES:.cpp=.o)
|
||||
EXECUTABLE = making_ex1
|
||||
|
||||
all: $(EXECUTABLE) $(SOURCES)
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS)
|
||||
$(CC) $(LFLAGS) -o $(EXECUTABLE) $(OBJECTS)
|
||||
|
||||
%.o:%.cpp
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
-include
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f $(EXECUTABLE)
|
||||
rm -f *.d
|
||||
Reference in New Issue
Block a user