Here is your converted HTML text with desired changes:

Begin Your Journey with C

To initiate your learning in C, you require the following:

  • A text editor for crafting C code
  • A compiler like GCC to convert the C code into a machine-understandable language

There are various text editors and compilers to select from. For this tutorial, an IDE (Integrated Development Environment) will be used by us.

Setting up the C IDE

An IDE is a software suite that consolidates the basic tools needed to write and test the code. Popular IDEs include Code::Blocks, Eclipse, and Visual Studio which are all free to use and facilitate both the editing and debugging of C code.

Note: Although web-based IDEs can be used, they typically have more limitations compared to their desktop counterparts.

We recommend starting with Code::Blocks. The latest version can be downloaded from here.

Let's Start with C

Create your first C file by following the steps below:

  1. Open Codeblocks
  2. Go to File > New > Empty File
  3. Write the following C code and save the file as myfirstprogram.c:
#include <stdio.h>, int main() { printf("Welcome to Fynd Academy!"); return 0;}

The above code might seem incomprehensible for now, we'll break it down in later chapters. For now, concentrate on running the code.

Executing Your Code

After writing the code, it's time to run it. In Codeblocks, navigate to Build > Build and Run. Your result will look something like this:

Welcome to Fynd Academy!

Great job! You've just written and executed your first C program.

Your C Learning Journey with Fynd Academy

Learning C with Fynd Academy is facilitated by our "Practice it Yourself" tool. It concurrently illustrates the code and the outcome, simplifying every new part you learn:

#include <stdio.h>int main() { printf("Welcome to Fynd Academy!"); return 0;} Welcome to Fynd Academy!

Practice it Yourself ยป

Fynd Academy Pathfinder

Track your progress as you embark on your learning journey. Best of all, it's complimentary!

<p>The mechanism of setting aside memory is known as allocation. The mode of allocation primarily depends on the type of memory. In C, there are two types of memory: Static memory and dynamic memory.</p> <h4>Fynd Academy Memory</h4> <p>Static memory is the memory allocated for variables before the execution of the program. Allocation of static memory is also termed compile-time memory allocation. In C, memory is automatically allocated for every variable at the time of program compilation. To illustrate, suppose you allocate an integer array for 20 students (e.g., for a summer semester), then C will set aside space for 20 elements equivalent to typically 80 bytes of memory (20*4).</p> <h5>Example</h5> <p>int pupils[20];<br> printf("%lu", sizeof(pupils)); // 80 bytes </p> <p>However, if only 12 students attend when the semester starts, then the space for the remaining 8 unused elements will be wasted. As you can't alter the size of the array, you are left with unnecessary reserved memory. The program will still run without any damage, but it may run less efficiently. If you want better control over allocated memory, consider Dynamic Memory below.</p> <h4>Dynamic Memory</h4> <p>Dynamic memory refers to the memory allocated after the program starts running. It can also be seen as runtime memory allocation. Contrasting with static memory, you can control how much memory is used at any given time. Code can be written to determine the needed memory and allocate it.</p> <p>To allocate dynamic memory, you can use the malloc() or calloc() functions, which require including the <stdlib.h> header. These functions allocate memory and return a pointer to its address.</p> <p>int *ptr1 = malloc(size);<br>int *ptr2 = calloc(quantity, size);</p> <p>Operators must be careful with sizeof(*ptr1), as it tells C to measure the size of the data at the address. Forgetting the * and writing sizeof(ptr1) instead will measure the size of the pointer itself, which is the (usually) 8 bytes needed to store a memory address.</p> <p>To allocate dynamic memory efficiently, it is recommended to use the sizeof operator. Notice, sizeof operator can't measure how much dynamic memory is allocated. When measuring dynamic memory, it only tells the size of the data type of the memory.</p> <h5>Example</h5> <p>int *pupils;<br>int numPupils = 12;<br>pupils = calloc(numPupils, sizeof(*pupils));<br>printf("%d", numPupils * sizeof(*pupils)); // 48 bytes</p> <p>When dealing with dynamic memory allocation, do not forget to check for errors and free memory at the end of the program.</p> <h4>Stack Memory</h4> <p>Stack memory, a type of dynamic memory, should also be mentioned for the sake of completeness. Stack memory is allocated for variables declared inside functions. When a function is called, stack memory is allocated for the contained variables. Once the function returns the stack memory is freed. It is essential to be aware of stack memory to effectively handle the memory usage of nested function calls and recursion. Recursive functions repeating too many times may result in excessive stack memory usage, a phenomenon called a stack overflow.</p> <p>Fynd Aacademy <br>Track your progress - it's free!</p>