Understanding C Pointers: Arrays, Parameters, and Pointer Operations
Array Name Semantics
When accessing array elements with pointers, we often write code like this:
int data[10] = {1,2,3,4,5,6,7,8,9,10};
int *ptr = &data[0];
While using &data[0] retrieves the address of the first element, the array name itself serves as the address. Consider the following demonstration:
#include <stdio.h>
int ma ...
Posted on Mon, 31 Aug 2026 16:27:15 +0000 by bigshwa05
Implementing the Snake Game in C with Console Graphics
Game Architecture and State ManagementDeveloping a console-based Snake game in C requires careful management of game state, including the snake's position, length, and direction. Unlike simpler programs, this game relies on a continuous loop that handles rendering, input processing, and logic updates. To encapsulate the game's properties, a str ...
Posted on Sat, 29 Aug 2026 16:49:53 +0000 by Tracer
LeetCode 414 Third Maximum Number
Given a non-empty integer array, return the third distinct maximum number in this array. If the third maximum does not exist, return the maximum number in the array.
Example 1:
Input: [3, 2, 1]
Output: 1
Explanation: The third distinct maximum is 1.
Example 2:
Input: [1, 2]
Output: 2
Explanation: The third distinct maximum does not exist, so t ...
Posted on Thu, 27 Aug 2026 16:20:00 +0000 by nepzap2
Implementing and Understanding Singly Linked Lists in C
A linked list organizes elements using non-contiguous memory blocks. Each node holds a data field and a pointer to the next node, forming a chain. The basic structure is defined as follows:
typedef struct SNode {
int value;
struct SNode *next;
} SNode, *SList;
Headless List Operations
Operations on lists without a dummy head node requi ...
Posted on Tue, 25 Aug 2026 16:00:21 +0000 by mraza
Implementing Singly Linked List CRUD Operations in C
Node Structure Definition
A singly linked list is constructed as a sequence of nodes, where each node contains a data field and a pointer to the subsequent node. The following structure defines a node with an integer identifier and a text label.
typedef struct ListNode {
int id;
char description[32];
struct ListNode* next;
} ListNod ...
Posted on Sun, 23 Aug 2026 16:41:43 +0000 by kampbell411
Core Concepts and Syntax in C Programming
The main Function and Basic Output
Every C program must contain a main function, which serves as the entry point. A minimal version looks like this:
int main(void) {
return 0;
}
The void keyword explicitly indicates the function expects no arguments. To display text, use the printf library function from <stdio.h>:
#include <stdio. ...
Posted on Sun, 23 Aug 2026 16:14:30 +0000 by andyg2
Implementing Custom Boot Menus in U-Boot for Allwinner T527
Experimental Environment
Hardware: Forlinx OK-T527 Development Board
Software: Allwinner Longan SDK (U-Boot version 2018)
U-Boot Initialization Flow
To understand how to inject a custom menu, we must first examine the entry point for U-Boot's main logic. The core execution loop is defined in /common/main.c, specifically within the main_loop() ...
Posted on Sat, 22 Aug 2026 16:21:37 +0000 by ottoman_
Pointer Manipulation and String Operations in C
Finding Minimum and Maximum Values Using Pointers
Version 1: Passing Pointers for Min/Max Output
This approach uses output parameters through pointers to return both the minimum and maximum values from an array.
#include <stdio.h>
#define SIZE 5
void read_values(int arr[], int count);
void display_values(int arr[], int count);
void locat ...
Posted on Wed, 19 Aug 2026 16:51:53 +0000 by Joefunkx
Essential C Programming Concepts
Core C Programming Concepts
C Program Compilation Process
Compilation Stages
The compilation of a C program involves four main phases:
Preprocessing: Expands macros, includes header files, processes conditional compilation directives, and removes comments without syntax checking
Compilation: Performs syntax validation and translates preprocess ...
Posted on Mon, 17 Aug 2026 16:15:02 +0000 by meanrat
DHT11 Single-Wire Communication Protocol: Data Format and Implementation
Data Packet Structure
The DHT11 sensor uses a single-wire communication protocol. Each data transmission consists of a 5-byte packet organized as follows:
Byte 0: Integer part of humidity
Byte 1: Fractional part of humidity
Byte 2: Integer part of temperature
Byte 3: Fractional part of temperature
Byte 4: Checksum byte
The sensor transmits da ...
Posted on Sun, 16 Aug 2026 16:49:52 +0000 by MadDogSh