Advanced Topics in C

Advanced Topics in C

In this lesson, you will learn about the more advanced topics in C programming. You will learn about multi-threading and networking, as well as different types of data structures, such as linked lists and trees. You will also learn about different types of algorithms, such as sorting and searching algorithms.

Example

#include <stdio.h> 
#include <stdlib.h> 
  
void bubble_sort(int arr[], int n) 
{ 
    int i, j, temp; 
    for (i = 0; i < n-1; i++) 
    { 
        for (j = 0; j < n-i-1; j++) 
        { 
            if (arr[j] > arr[j+1]) 
            { 
                temp = arr[j]; 
                arr[j] = arr[j+1]; 
                arr[j+1] = temp; 
            } 
        } 
    } 
} 
  
int main() 
{ 
    int arr[] = {64, 34, 25, 12, 22, 11, 90}; 
    int n = sizeof(arr)/sizeof(arr[0]); 
    bubble_sort(arr, n); 
    printf("Sorted array: \n"); 
    int i; 
    for (i = 0; i < n; i++) 
        printf("%d ", arr[i]); 
    printf("\n"); 
    return 0; 
}

Output

Sorted array: 
11 12 22 25 34 64 90

Leave a Reply