Holberton School arrives in Peru!

Welcome Holberton School Peru! While Peru is known for its Machu Picchu’s stunning views – it is also one of Latin America’s fastest-growing startup scenes. In 2018, Peru attracted more impact-investment capital than Mexico, a long-time leader in the region. In 2019 a new record was set for the amount of capital invested into local startups, with a 24% increase compared to 2018. Before the pandemic, Peru already had a deficit of 17,000 software engineers, a number estimated to grow dramatically due to COVID-19 acceleration on digital transformation. 

This acceleration will affect all industries as stated by Juan Carlos Tassara, Edifica Executive Director:

“The real estate, as well as other traditional industries, increasingly need to introduce new technologies to differentiate themselves. Holberton’s proposal prepares the talent that Peru needs in a fast and innovative way, talent that will drive the country’s digital transformation.” 

Holberton School comes to Peru in alliance with social entrepreneurs Valery Vargas and Gabriel Bedoya. Due to the COVID-19 pandemic, the campus will first open as a remote program providing its education entirely online; facilities will open in Lima as soon as possible.

To help make Holberton’s education financially accessible, multiple ways to finance tuition will be available: upfront payment, monthly payments, loans, or Income Share Agreements. Also, scholarships will be offered. 

“For the first cohort, and because we know how this pandemic has impacted thousands of students that had to stop their careers, we will offer 15 full-tuition scholarships,” says Holberton School Peru Co-founder Valery Vargas.

The school will begin welcoming its first cohort of students in January 2021. Check out the Holberton School Peru campus page to learn more!

How a Foundation turned Tulsa into a startup city

Experimenting, catalyzing, and risk-taking for big goals are essentials for every Silicon Valley entrepreneur; they are also for Ken Levit, Executive Director of the George Kaiser Family Foundation (GKFF) – a philanthropic organization based in Tulsa, Oklahoma. The city, long known for being the Oil Capital of the World, is in the process of re-inventing itself to renew the shininess of the early 20th century.

George Kaiser is a Tulsa-native who led the energy family business to be highly successful. But as the city’s pivotal role in the energy industry eroded, dragging its economy along, he created a foundation to give back and help his community with the mission of focusing on early childhood education as a way of interrupting the cycle of poverty and, more broadly, to give equal opportunity to all.

GKFF achieves that mission by focusing on three main pillars: talent, economic opportunities, and city life quality. Levit chose to drive the foundation with a startup mindset “philanthropy can be good at trying new things, having a high-risk tolerance for failing, and if it’s a flop, we can try something else!”.

By partnering with Foundry College, Tulsa expects to provide talent that the U.S. economy needs. Their program management curriculum prepares students to accept one of the 22 million jobs that should be created by 2027. At the same time, the college Salesforce Administrator program targets the 400k jobs expected by 2022. Michael Basch, the managing partner at Atento Capital, estimates that students graduating from the Salesforce program will be able to find remote jobs paying up to $65,000 a year. Atento Capital and GKFF partnered to offer both programs for free – each valued at $6,000 – to local students. 

The foundation also partnered with us, Holberton School, a software engineering program training Silicon Valley grade developers. With campuses on five continents, our graduates are getting hired by the world’s top companies like Apple, Tesla, Rappi, and LinkedIn. Students don’t pay their tuition until they find a job. For the Tulsa campus, GKFF is sponsoring a $1,500/month need-based living assistance for students. The unemployment rate in computer-related occupations dropped from 3 percent in January to 2.5 percent in May. The pre-pandemic U.S. economy had 918,000 unfilled IT jobs and included the suspension of H-1B visas. Individuals using these visas had been used to fill many openings in computer-related professions. With these changes, the market for software talent is expected to be hot.

Levit explains that while “the world of economic development is focusing on recruiting companies, by throwing money and tax incentives at them,” they wanted to take a different approach that is about people. On top of upskilling the locals, GKFF is investing in attracting outside talent. The Tulsa Remote program offers to anyone who wants to move and work from Tulsa a $10,000 stipend, a desk in a co-working space, and help to find a home. The results are just astonishing: they received over 20,000 applications with thousands of additional candidates currently in the pipeline. Since the program started in 2018, 250 people have moved to Tulsa with a 95% retention rate, leading to the purchase of 40+ homes. The program attracts high-quality talent and provides an average salary of over $100k. These statistics are not surprising, considering these remote workers are working for top companies like Cisco, ADP, Deloitte, IBM, and Microsoft.

The city itself is starting to attract the interest of leading businesses. Tulsa was among the top two choices for Tesla’s next facility, competing with Austin. A talent pipeline development leader working for Google told Basch that the company would consider opening offices in the city once they could provide 500 software engineers, a goal that he hopes to achieve soon with the help of Tulsa University and Holberton School.

But that’s not it. Levit also wants its fellow neighbors to enjoy life in Tulsa and is looking to have a “culture, stimulation, a rich and vibrant life.” Among many projects, The Gathering Place park, which Basch describes as “Disneyland meets Central Park,” is the most distinctive. A 100-acre green space developed with a half-billion-dollar investment, featuring entertainment for kids and adults.

The pair recognize that there is still a lot to be done and that the city’s economy – still mainly driven by oil, gas, and aerospace – faces significant challenges made worse by the pandemic. But they also believe that it is a turning point for the local economy. COVID-19 has drastically increased the number of companies willing to let their employees work remotely. They are now also considering hiring remotely, where talent can be cheaper than in the megalopolis. Basch thinks that NYC, with Michael Bloomberg, was “the MVP city for 2001 to 2010,” followed by Texas for 2011 to 2020. He believes that Tulsa is strategically placed for the decade to come.

Learn more by listening to Holberton Co-founder Sylvain Kalache interviewing GKFF’s Ken Levit and Michael Basch.

Holberton School is coming to Ecuador!

Holberton School is opening in Ecuador in alliance with BuenTrip Hub, the local incubator for technology startups. Ecuador’s tech scene has been drastically growing in the last few years. The country, which had 70 tech startups in 2018, is now counting 250 of them according to BuenTrip’s Radar Tech Startup study. All are looking for highly-qualified software engineers. The International Labor Organization (ILO) recently reported that e-commerce, software development, and IoT were the top industries for Ecuador’s job creation.

Carmen de la Cerda, director of BuenTrip Hub, says, “Holberton will provide Ecuador students with world-class training. Access to this knowledge and skillset is indispensable because it will empower our local talent, opening doors for them to become technologists and innovators.”

Holberton School Ecuador’s first online cohort will begin in January 2021, synchronizing with the school’s network of campuses located in North and South America, Europe, Africa, and Asia. To help make Holberton’s Silicon Valley-grade education financially accessible, tuition can be paid either upfront or in monthly payments. Applications are open to individuals over the age of 18, coming from any educational background. To learn more about Holberton School Ecuador, visit the Ecuador campus page!

Mary Gomez: from chemical engineering to programming

Mary Luz Gómez is a 36-year-old chemical engineer who worked for ten years on innovation as a product and project leader. One year ago, she quit her job at Kimberly Clark to pursue her new dream: becoming a Machine Learning developer. 

mary gomez medellin cohort 10 holberton colombia

Mary is a disciplined woman with clear goals and a persevering personality. When working for Kimberly Clark, she learned about technologies such as Machine Learning and Data Science. Mary remembered enjoying her programming classes back in college and knew this path was her future.

While looking for study options, she realized that traditional education was not right for her because she learned much better with practical projects. During her research, Mary found out about Holberton school’s project-based learning methodology and was drawn to it because she felt “Holberton is very similar to how we work in companies.” 

Mary found the admission process fun because it challenged her to learn new things. She barely knew anything about programming and had never made a website, but she passed and started the program in September 2019. 

“I didn’t want to be left with the question of What if I’m a programmer? I was passionate about innovation and technology, so I decided to do it,” she remarked.

The first day in school was difficult: she remembers crying when she realized the day was over, and she still hadn’t been able to do the assigned project, but she knew the idea was not to give up. Her peers were always there to help, and she is grateful for it.

mary gomez medellin cohort 10 holberton colombia
Cohort 10 students, Holberton Medellín.

One of the reasons that led her to choose Holberton was its Income Share Agreement (ISA) payment model: “I found it very inclusive. I will be delighted to give every cent after I graduate with the guarantee that someone else will have the opportunity to study,” Mary said. 

While finishing the first part of the curriculum last June, Mary had the opportunity to work with Skillshare for her final project at Holberton. After starting the Machine Learning specialization, the company decided to hire her as a Software Engineer. So she decided to seize this great opportunity and paused the Specialization for the moment.

“I don’t have a plan for the long term, but I like to bet on what I’m passionate about. Today I have a new career and new goals. My next step is to finish the Machine Learning specialization and continue to challenge myself,” concludes Mary. 

Holberton School Colombia was the first international campus that opened in Bogotá in 2019 with 50 students. Since then, it has grown to three more cities: Medellín, Cali, and Barranquilla and now it counts more than 700 students in Colombia. You can join one of the campuses for January 2021: Applications are open!

The Holberton School Hauts-de-France campus is opening!

We are thrilled to announce the opening of the Holberton School Hauts-de-France (HDF) campus! Following Holberton School France online opening last August, this new campus, founded by Benjamin Dhellemmes, entrepreneur linked with the local Tech ecosystem, and Benoit Denot, former COO/CFO in healthcare and digital companies, is strategically located at Europe’s crossroads. The HDF region and Lille metropolis host more than 70 retailer headquarters like Decathlon, Kiabi, and Auchan. But also 17 startups incubators as well as 160 e-companies like OVHcloud, aDvens, and Showroom-prive.

“Hauts-de-France is home to the most successful retailers in Europe, and a flourishing startup ecosystem,” Says Holberton School HDF Co-founder Benoit Denot “Holberton School Hauts-de-France will train a diverse and Silicon Valley grade workforce that the local companies need.“

The campus is partnering with local investors, hiring companies, and tech communities, among which are: EuraTechnologies (one of Europe largest startup incubator), Jezby Ventures (OVHcloud Founder Octave Klaba’s fund), ÏDKIDS Group (a major French retailer), Vade Secure (global leader in predictive email defense), the French Tech community and many more.

Holberton School Hauts-de-France

“Tech ecosystems are growing all over France, we were impressed by Hauts-de-France region’s one,” Says Holberton Co-founder & President Sylvain Kalache “it is in this type of dynamic and vibrant communities that Holberton School shines.”

Holberton brings Silicon Valley grade education to an already robust education ecosystem. The Hauts-de-France region is where most French engineers are trained, with over 30 Grandes Ecoles and six universities. Due to COVID-19, the school will provide its education entirely online from January 2021. A physical campus will open as soon as the pandemic allows. Start your application today.

Welcoming Grammy award-winning producer Alcover to our Board of Trustees

We are honored to welcome Alcover to the Holberton Board of Trustees! Milton J. Restituyo, better known as Alcover, will contribute toward Holberton’s mission to increase access to tech education with a focus on the Hispanic community. 

The Latin Grammy award-winning producer is also a singer and influencer in Hispanic pop culture. Born in La Vega, Dominican Republic, Alcover’s interest in music was sparked at an early age thanks to his father, a singer and multi-instrumentalist. After making the decision to move to New York, he took the first steps in commencing his musical career, enlisting his high school classmate Juan Abreu “Xtassy” as his creative partner. Together the two formed the award-winning production duo A&X, positioning themselves among the best producers in New York City’s urban scene.

Grammy award-winning producer Alcover

“Pop culture allows us to see what is needed now and what is important in our communities. It has enabled me to use my voice in an uplifting and encouraging way.  Music, art and technology that is created and distributed by ethnic and socioeconomic diversity helps create unity and accessibility,” said Alcover. “Holberton provides to any students, including the ones from disenfranchised communities, access to education in tech, and gives them a way out. I want more people to leverage the Holberton opportunity. Tech companies are seeking diverse, and motivated software engineers to drive them towards the future,“ he added. 

Join us in welcoming Alcover to the Holberton community!

From delivering packages to writing code for unicorn startup Rappi

Kevin Giraldo is a 21-year-old Holberton School Colombia student from district 8 of Medellín, a low-income neighborhood with an average household income of US $135 per month. He grew up in a low-income family. Kevin occasionally worked with his father in a manufacturing company and understood that education was the way to have a better future. He discovered programming in high school and convinced his parents to buy him a computer, promising that this was the key out of their situation. Kevin recently started fulfilling that promise.

At fourteen, as he witnessed his teacher automating the voting process at school, using code, he understood that he wanted to be a programmer. “It was a straightforward case, but since I didn’t have any programming knowledge at the time, I found it very interesting”.

Kevin decided to switch from his high school to one that would offer programming classes. He continued to pursue his dream to become a developer by enrolling in a computer engineering undergraduate degree while working as a Rappi delivery to make some money on the side.As he was working, Kevin received a message from Rappi about Holberton School. A Silicon Valley software engineering program was opening in Medellín. Registration was closing the next day, and he decided to meet the deadline and apply. As he was going through the application process, Kevin thought he would never be good enough to be accepted into the program.

Kevin started his training at Holberton in September 2019 and recalled that one of his biggest challenges was having to comment on his code in English. However,  “the fact of not having teachers and having to do projects among ourselves [the classmates] made us very autonomous and independent.”

Because Holberton’s program was very intense, Kevin decided to only do delivery work on weekend nights, as he was one of the students who could not go to sleep until he finished the entire project.

For the final part of the training, Holberton partnered with tech startups Rappi, Kiwi, Ubidots, Skillshare, and Torre so that students could develop a final project that would solve these companies’ needs. Each company presented its challenges and provided mentoring through its engineers. That is how Kevin, together with two classmates, developed a crowd lending platform so people could obtain a loan to get the necessary tools to work as Rappi drivers.

Rappi was so impressed by Kevin’s project that they offered him a software engineering job.

The 21-year-old programmer’s goal is to stand out with his performance at Rappi and to grow within the company. He also wants to create a programming community at El Pinal school, located in Enciso neighborhood (District 8 of Medellín), where he studied most of his basic training.

“As my family is low-income, my ambition was always to get out of here and grow. It is not hating or being ashamed of my roots, but wanting to grow and help my family, my friends and my community”.

Kevin Giraldo

Phil Holberton fireside chat about Betty Holberton, leadership & diversity

Holberton School was named after Frances Elizabeth “Betty” Snyder Holberton who was one of the six programmers of the ENIAC, which was the first programmable, general-purpose electronic digital computer. Betty Holberton helped create what would later become modern-day software engineering.

We recently had the honor to welcome Phil Holberton, who is Betty’s nephew, for a fireside chat with our students. Former CPA, Phil Holberton delivers executive-level excellence via his consulting firm, the Holberton Group, and publishes a periodic online bulletin, Speaking of Leadership.

Below is a highlight & edited version of some of the Q&As that happened during the fireside chat. The discussion covered Betty Holberton, leadership, and diversity.

Would you mind telling us about Betty Holberton and what made her such a great problem solver? 

Betty Holberton had a very strong analytical brain. Believe it or not, when she went to school at the University of Pennsylvania she wanted to join the math department. A profession in the math department said “uh uh” you’ve got to go to Home Economics, Political Science, Journalism or some other department. That began her career in saying, “I am not going to take no for an answer”. She was a very intelligent woman and she had a very strong voice in what she believed in and she just went about it and her problem-solving skills, which I am sure we will get to a little bit further down the line of conversation here, she got to use them quite a bit.   

Is it true that in the beginning due to ENIAC projects being classified, Betty and other computers could only work from diagrams and blueprints? 

True. As I understand the story, six of the best and the brightest we call to program computers for artillery during World War II. Computers were as big as most rooms are these days. They handed the plans to Betty and her five cohorts and they say, “All we do is have the wiring diagrams and you have to go and figure and help us program this”. And those women, as smart as they were, they figured it out. We are grateful for her past because that was the first computer basically in the United States, the Antioch. 

Is it true that Betty solved more problems while sleeping?

All the people in psychology and social sciences would say [that] more stuff is done at the subconscious level than any conscious level. Whatever she did at the conscious level was worked over 2 or 3 times in the unconscious level. I don’t know it for fact, but I’m following what goes on in science, but probably presumably so.

When is it necessary to sacrifice individual needs to fulfill team goals and how do you reconcile these differences afterward?

The most important attribute of any company or any organization is to have a vision and a mission statement and you have some culture to help you get there. The interest of the company proceeds the interest of any individual and any team. I am often reminded of the event [with] Johnson & Johnson [about] twenty years ago when they tampered with Tylenol and put poison in it. I can’t remember how many people were killed but it was devastating to America. The CEO at that point in time says, “I don’t care how much it costs. We are taking all of the product off of the shelf and we are all going to start over on Tylenol”. Tylenol was the biggest brand in the world but no one person trumped the ideal mission. “Our customers come first and we protect our patients and out users of our product”. I read somewhere that it may have cost them 250 million or a half a billion dollars to do that and where they probably could have done something different, but that showed integrity. You have to live, I don’t want to say a higher power but you have to have a higher North Star which is usually organizationally driven. 

How should leaders best motivate their employees and try to build a sense of community? 

The most important thing about leadership is to think of it in two dimensions: Transactional Leadership and Transformational Leadership. Transactional Leadership is when you have control of their paycheck, bonus, and time off, so someone is working for the transaction. The best type of leadership is transformational when they work for you because they want to work for you and they aspire because you are a really good human being. Granted, it is hard for a lot of leaders to behave that way because they were brought up to be A-Types and command and control. When I work with CEOs today, we spend a lot about putting water and sunshine on their executive team and the people inside their organization because If they grow they will be able to grow themselves. I turn it around. If you ever heard the concept of Servant Leadership- it’s like flipping the leadership chart around where the leader is always serving the organization- that’s their higher power. If you can inspire an organization to reach for that North Star and achieve things that otherwise don’t appear attainable, you’ve done a really good job. During this COVID period some of our CEOs rose to the occasion more than I would ever imagine. They are less about command and control and they are more about how they can inspire their entire team to come with me and help us get through this COVID period.

How can one become smarter, more adaptable, and emotionally intelligent?

There are diagnostic tests that help you get a baseline on your emotional intelligence. I advocate a test called Mindsets by a professor in California, Ryan Gottfredson. It is free and it will help you understand whether you have a defensive posture or an offensive posture in the four different dimensions. 

When I was teaching at Brandeis my students would ask if leaders were born or were they made. What do you think my answer was? I would say “Yes”. Some had more natural talent than others but like anything, in life, you have got to keep practicing. Some people may have zero knowledge of what the word emotional intelligence means and they may have absolutely incredible natural talent and don’t have to worry about it as much as people that it’s more awkward for. From my perspective, if you want to navigate and get the best out of life, learning this skill is really important for you to learn over time. It will help you in your marriage, in your community, and in your business. I would say to learn that early and often. Practice it.

Why has there been more focus on emotional intelligence separately from IQ recently?

Most hiring practices in North America look at two things: your prodigy and where you grew and they try to assess intellectually your intelligence, particularly if they are trying to hire someone on the inbound side to help them grow within the company. 

IQ has always been an important barometer for any hiring organization. I would say companies are now getting more sophisticated in understanding people’s emotional intelligence because they are beginning to recognize that this is a more important attribute as people move up the ladder. I’ve seen statistics that say 75% of the people that work in the company say that they like the company but they don’t like their boss. That says something about your boss in terms of emotional intelligence and if your boss is oppressive, it is going to make it very hard to work for. That being said, emotional intelligence together, we as a society can get much further.

How can those of us in STEM help support diversity? 

One thing I am inspired by at the Holberton is it’s a diverse organization and prides itself on admitting students of diverse backgrounds, nationality, color, and ethnicity. The Holberton school within itself is the living practice of what needs to go on in this world. One of my CEOs says “It’s our behaviors that count. It’s not our talk”. Holberton invites people of different nationalities to come in different stages of their career-which is a wonderful attribute. I would opine that the more you get to know people that are not of the same ethnicity as yourself build those friendships and those strengths. Make sure to include time in your schedule every day to build those relationships. When you go work for and they have a couple of hundred programmers, get to know the people first. That’s more important than all the technical skills. Having those relationships is really important. I encourage every man, woman, Black, Asian, American, Indian, regardless of nationality, get to know the people first; get to know your peers and your bosses. We are all human beings. Even though they might be a boss…

When a leader makes a mistake, how do they apologize and make things better for everyone?

First of all, an “I’m sorry” goes a long way. I am learning a lot about communications in my job now working with CEOs. There is a difference between communication that comes from the head and communication that comes from the heart. If you say I’m sorry from the head, forget it, nobody will see it and nobody will believe it. If you come and you talk from the heart, and a lot of CEOs find that hard because they are on defense and want to have a strong view of themselves and not vulnerable. I encourage you to follow Brene’ Brown and her work on vulnerability. She is one of the sought after forefront of thinkers in terms of emotional intelligence, vulnerability, and how to behave as a leader. You have to say it from your heart. If you are not programmed that way, to speak from the heart, one activity you can try is to turn up your music and microphone and speak or write like you are journaling and journal from the heart and usually, you will have something that will start to work there. I have had several CEOs in the last week give me communications they want to share with staff, they were all fine but they did not come from the heart. You will be far more effective if it comes from the heart. Everyone needs to develop these skills.

We are very grateful for Phil for sharing his time, wisdom, and knowledge with our community and for his support of the Holberton School since its inception. The full chat recording is available below.

Holberton School is coming to France!

We are thrilled to announce that Holberton School is opening in France! The opening has been fast-tracked as Julien and I (Holberton founders), both French, wanted to help our country. Unemployment rates in France rose to 22 percent due to COVID-19, and one of the biggest software engineering schools, SUPINFO, is in liquidation.

Director of operations Julien Cyr and I are both alumni of SUPINFO, one of the largest software engineering schools in France. Due to SUPINFO’s liquidation, a thousand students who already paid for their education – some of whom already paid for several years of school in advance of completing it – may suddenly find themselves out of school and unable to recoup their costs, beginning in September. To support our community, Holberton School France will cover the cost of the first year of our program for any SUPINFO students who wish to enroll, making the first year completely tuition-free.

In addition to helping SUPINFO students, we also wanted to help people impacted by the economic consequences of the pandemic and resulting unemployment rate. As such, Holberton School France will cover the first-year tuition–valued at €6,120–for the first 165 admitted students, the equivalent of €1,000,000 of scholarship value.

Holberton School France’s first student cohort will begin online on September 7th in synchronization with Holberton’s 12 other campuses spanning 6 additional countries.

Code review: string concatenation in C

Today, we are going to go through the following code.

The very interesting thing about this code, is that when compiled and ran, it seems it is working just fine. But actually it is not working properly and there is a big problem with it 🙂 And by going through it we are going to learn a ton of things.

At Holberton, we have a strict coding style for each programming language we are using. Let’s start by applying our coding style for C.
main() should be written main(void). Is that a huge mistake? No. But this forces us to be more structured, and always explicitly write everything.
– We don’t want to initialize our variables at the same time as we are declaring them (Exceptions can apply for arrays.)
– Also we want to group our variable declarations together.
– No empty lines within the code. Only one empty line between declaration and code.
So the code should look like this:

It’s cleaner, more professional, follows the style of the school (remember that in any company we have to follow the coding style of the company, so it’s important that we get into the habit of following strictly one particular style).

We are using the function printf without including its prototype. So when we will compile, we will get a warning from the compiler, even without additional flags.

In order to know the prototype of a function, we can always look at its man page. In this case, man 3 printf.

The man page gives us the prototype and what header to include. We can use either to indicate to the compiler what is the prototype of the function printf (and make the warning go away). We don’t strictly have to include the header, we can simply include the prototype itself. Like so:

But it’s a good habit to include the header (which includes the prototype).

Now let’s see what is happening in the program and why it is working but not really. We will go step by step through the code and look at what happens in memory. Let’s start with the declarations:

At this point, this is what the virtual memory looks like (we are going to assume we are working on a 64-bit, Linux machine):

Note: In the value line, I do show the letters for each byte of the arrays aa and bb, but what is actually stored in the virtual memory is the ascii code of this letter. (man ascii).
I also added some colors to make sure we can see the limit of each space reserved in the memory by each variable.

– The string literals are copied into the addresses of the arrays. The arrays have been automatically sized (the compiler can do that because it knows the size of the string literals to copy).
a and b are pointers so on a 64-bit machine they take 8 bytes in memory.
– The variable aa, is an array of chars of size 14 bytes (14 chars, so 14 * sizeof(char) = 14 bytes).
– At this point the variables a and b have a value but we do not know what it is. The next two lines of code will initialize them.

After these two lines of code, a points to the first letter of the array aa (so it contains the address of the first letter of the array aa, which is also the address of the array aa) and b points to the first letter of the array bb. This is what the virtual memory looks like:

So far so good. With the next lines of code we are going at the end of the “string” (remember there is no type string in C). This code is correct. So at the end of the while loop, a points to the \0 of the array aa.

At the end of this while loop, the virtual memory looks like this:

The next lines of code are the following:

The above loop copies the content of the array bb (remember, b points to the first char contained in bb) at the end of the array aa (as the variable a, at the beginning of the loop, points to the last char (\0) of the array aa). And that is both what we wanted the code to do, AND the problem 🙂

The content of bb is copied, one char at a time, starting from the memory address 19 (in our example). But, our variable aa ENDS at 19 too. That means that we are writing the content of bb AFTER the variable aa, not inside. After 12 iterations, the virtual memory (in our example) looks like this:

In red, we have written 11 bytes outside of the memory reserved for aa, and will continue to do so via the loop for another 10 bytes. The problem of course, is that we are probably replacing the values of other variables, or writing in a memory address that we do not have write access (and will get a beautiful Segmentation Fault). In this particular case, the program still runs “properly” and without warning (because we are unlucky), and as a result, we don’t realize that we are making a mistake.

In fact, in this example, we are actually “destroying” our array bb. Let’s modify a bit the program in order to check that out:

It seems like we changed bb by concatenating it to aa. But bb is not 1 char “shorter”, it still takes the same size in memory, but its content has changed. It is happening, because in the actual virtual memory of our running process the two arrays are next to each other, like so:

I removed the vars a and b for clarity.

So when we are concatenating bb to aa, we are doing this (concatenated letters in pink):

After this concatenation, bb size doesn’t change, but now the content has changed, and it “seems” it was shifted to the left by 1 char. But that’s because the - of the beginning is now part of aa as the last letter in the reserved memory for aa. Note that bb now has two \0, the one copied, and the initial one.

THE END 🙂 If you would like to learn more about the virtual memory, you can read these articles:

To finish with, I would like to thank the author of this code, because thanks to them we learn a ton of things!

“Experience is simply the name we give our mistakes.” Oscar Wilde

Happy coding!