Skip to content
Snippets Groups Projects
Commit ca6b65b7 authored by thib's avatar thib
Browse files

template

parent 3c6211bb
No related branches found
No related tags found
No related merge requests found
main: main.o
gcc -o $@ $< -fsanitize=address -fsanitize=leak
main.o: main.c
gcc -c -Wall -Wextra -pedantic -fsanitize=address -fsanitize=leak $<
clean:
rm -f *.o main
rebuild: clean main
\ No newline at end of file
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _element {
char c;
struct _element *next;
} element;
int main(int argc, char **argv) {
// read user input
char str[16];
scanf("%s", str);
int len = strlen(str);
// cli args
if (argc == 1) {
printf("need more arguments");
return EXIT_FAILURE;
}
for (int i = 0; i < argc; i++) {
if (!strcmp(argv[i], "-c")) {
// do stuff with atof/atoi (argv[++i])
}
}
return EXIT_SUCCESS;
}
\ No newline at end of file
main: main.o
gcc -o $@ $< -fsanitize=address -fsanitize=leak
main.o: main.c
gcc -c -Wall -Wextra -pedantic -fsanitize=address -fsanitize=leak $<
clean:
rm -f *.o main
rebuild: clean main
\ No newline at end of file
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _element {
char c;
struct _element *next;
} element;
int main(int argc, char **argv) {
// read user input
char str[16];
scanf("%s", str);
int len = strlen(str);
// cli args
if (argc == 1) {
printf("need more arguments");
return EXIT_FAILURE;
}
for (int i = 0; i < argc; i++) {
if (!strcmp(argv[i], "-c")) {
// do stuff with atof/atoi (argv[++i])
}
}
return EXIT_SUCCESS;
}
\ No newline at end of file
main: main.o
gcc -o $@ $< -fsanitize=address -fsanitize=leak
main.o: main.c
gcc -c -Wall -Wextra -pedantic -fsanitize=address -fsanitize=leak $<
clean:
rm -f *.o main
rebuild: clean main
\ No newline at end of file
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _element {
char c;
struct _element *next;
} element;
int main(int argc, char **argv) {
// read user input
char str[16];
scanf("%s", str);
int len = strlen(str);
// cli args
if (argc == 1) {
printf("need more arguments");
return EXIT_FAILURE;
}
for (int i = 0; i < argc; i++) {
if (!strcmp(argv[i], "-c")) {
// do stuff with atof/atoi (argv[++i])
}
}
return EXIT_SUCCESS;
}
\ No newline at end of file
main: main.o
gcc -o $@ $< -fsanitize=address -fsanitize=leak
main.o: main.c
gcc -c -Wall -Wextra -pedantic -fsanitize=address -fsanitize=leak $<
clean:
rm -f *.o main
rebuild: clean main
\ No newline at end of file
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _element {
char c;
struct _element *next;
} element;
int main(int argc, char **argv) {
// read user input
char str[16];
scanf("%s", str);
int len = strlen(str);
// cli args
if (argc == 1) {
printf("need more arguments");
return EXIT_FAILURE;
}
for (int i = 0; i < argc; i++) {
if (!strcmp(argv[i], "-c")) {
// do stuff with atof/atoi (argv[++i])
}
}
return EXIT_SUCCESS;
}
\ No newline at end of file
main: main.o
gcc -o $@ $< -fsanitize=address -fsanitize=leak
main.o: main.c
gcc -c -Wall -Wextra -pedantic -fsanitize=address -fsanitize=leak $<
clean:
rm -f *.o main
rebuild: clean main
\ No newline at end of file
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _element {
char c;
struct _element *next;
} element;
int main(int argc, char **argv) {
// read user input
char str[16];
scanf("%s", str);
int len = strlen(str);
// cli args
if (argc == 1) {
printf("need more arguments");
return EXIT_FAILURE;
}
for (int i = 0; i < argc; i++) {
if (!strcmp(argv[i], "-c")) {
// do stuff with atof/atoi (argv[++i])
}
}
return EXIT_SUCCESS;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment