Motivation is one of those things that come and go, frequently. I may feel motivated during the day, for a couple of hours or, maybe even days. On the other hand, lack of motivation may also manifest during the day, for a couple of hours, or maybe even days.
Better yet, I would describe motivation as a positive mindset, the desire to be able to achieve a goal. Motivation is a vehicle that can be used to drive the bumpy road that leads to the goal, the end result. …
First, let’s take a look at the man page of this function. We can use the FreeBSD version of this function.
strtrim removes all whitespace characters from the beginning and the end of a string.
In other words, it will remove all the unnecessary white that you might have in a string, for instance:
char *str = " Hello world! "
Now that we know what it to do, let’s divide this implementation into small steps.
Probably you are asking yourself, what is this?
A meme is worth than 9001 words:
I would describe 42 as a tuition free coding school that revolves in a peer-to-peer ecosystem. It is very similar to a workplace, where critical thinking and problem solving skills go hand by hand, and a project based curriculum that can be completed at your own pace.
A student needs to have patience, determination, intuition, and a problem solving mindset. That’s why logic tests are simple, minimalist, and without instructions. …
You have probably seen a ternary operator (also known as a conditional expression) before in a source file, or somewhere else. In C, and in a lot of language with similar syntax, we use the
? character to represent this operator.
Most beginners (by my own experience), find it a bit difficult to understand this operator, even though they have already mastered the
else statements. I believe the reason for this is that it is a bit difficult to read and to write it, because having different operations in the same line can be confusing. Really.
Most likely, you already know how to use them, or at least, how to read and understand the logic behind them. In case you don’t, maybe the following “beautiful” ASCII art representation that I just made for you guys, will help you out. …
Can you do a strlen implementation in just one line? Being that line under 80 characters (no cheating), and without the use of if-else statements, and/or while loops?
Yes, you can.
size_t strlen(const char *s)
Don’t believe me? Try to compile it.
Before getting into this subject, we first need to understand exactly what is a type in C.
“A type refers to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.”
Let’s say that every donut in the image above is a type. The chocolate one is an int, the one with the sprinkles are unsigned int, the one with white icing and sprinkles is a char, and so on… Every single one is different in some way from another one. …
Today, Panama commemorates the memory of all people who died during the riots in 1964, caused by the conflict between Panamanian students (Instituto Nacional), and the Canal Zone Police officers.
Governor Robert John Fleming prohibited to fly U.S. and Canal Zone flags outside schools, post offices, police stations and other civilian locations where it should be (outside the zone). Zonians (those associated with the Panama Canal Zone), were outraged by Fleming’s prohibition, and they began their demonstration with the U.S. flags. Students skipped classed, and raised another flag (Panamanian), and posted guards to prevent its removal.
Here is a list of some videos that can help you understand better some of the basic computer science concepts. Shout-out to Pannenkoek2012 for making this videos, check his Youtube Channel!
After reading this title, you’re probably feeling like this:
This may be a little hard to understand as first. I mean, a function parameter? You probably have some questions, such as:
Fear no more! I shall answer all these questions, and more! ;)
First, how do I declare this? A simple prototype for a function which takes a function parameter (sometimes called a formal parameter), is something like this:
void myfunction(void (*f)(int));
This states that a parameter
f will be a pointer
(*f) to the function
myFunction, which has a
void return type and which takes just a single int parameter. In lay man's terms,
myFunction takes an argument of a function type void, that returns a type void, and takes an int as an argument;
(void (*f)(int)). …
Un makefile es un archivo de texto que tiene un conjunto de reglas, para automatizar la compilacion un programa, de forma simple y organizada. Make se puede usar para compilar cualquier lenguaje, pero en este caso usaremos el Lenguaje C.
El siguiente Makefile lo puedes usar como planilla para compilar sus programas en C de forma muy rapida.
# Nombre del programa
NAME = <nombre># Flags de compilacion
FLAGS = -Wall -Wextra -Werror -g -Ofast# Directorios
SRC_DIR = ./srcs/
OBJ_DIR = ./obj/
INC_DIR = ./includes/
LIBFT_DIR = ./libft/
MINLBX_DIR = ./minilibx/# Archivos fuentes y objetos
SRC_FILES = $(wildcard $(SRC_DIR)/*.c) …