C Articles

Page 3 of 96

DTH Sensor Programming

Saba Hilal
Saba Hilal
Updated on 15-Mar-2026 2K+ Views

DHT11 and DHT22 sensors are digital sensors that can measure temperature and humidity. The DHT22 is more expensive but offers better accuracy and wider temperature ranges compared to DHT11. These sensors communicate with microcontrollers like ESP32 using a single−wire digital protocol. Syntax #include "DHT.h" #define DHT_PIN pin_number #define DHT_TYPE DHT11 // or DHT22 DHT sensor_object(DHT_PIN, DHT_TYPE); DHT11 Specifications Parameter DHT11 DHT22 Temperature Range 0°C to 50°C −40°C to 80°C Humidity Range 20% to 80% 0% to 100% Temperature Accuracy ±2°C ±0.5°C Humidity Accuracy ...

Read More

The Adafruit.io

Saba Hilal
Saba Hilal
Updated on 15-Mar-2026 2K+ Views

Adafruit.io is a cloud-based IoT platform that enables real-time data visualization and device control through web dashboards. It provides free service with an intuitive interface for connecting IoT devices via WiFi, using authentication keys and feeds to manage data flow between devices and dashboards. In this article, we demonstrate how to connect an ESP32 microcontroller with a BMP180 sensor to an Adafruit.io dashboard for monitoring environmental data and controlling an LED remotely. Required Components ESP32 development board BMP180 sensor (temperature, pressure, altitude) Blue LED Breadboard and jumper wires Adafruit.io account Circuit Connections Connect ...

Read More

The First IOT Program

Saba Hilal
Saba Hilal
Updated on 15-Mar-2026 1K+ Views

To start learning IoT, first, it is important to learn how to make circuits using a breadboard and a microcontroller. Then it is important to control that circuit using a program. There are some simulators available to make the beginner of IoT learn both these concepts without even having the IoT devices available. However, to get real results, using the circuit components and making the actual circuit is important. In this article, using two different examples, the way to start IoT programming is given. In example 1, the Wokwi simulator is used and in example 2, the actual circuit using ...

Read More

How Much Java is Better than C?

Mr. Satyabrata
Mr. Satyabrata
Updated on 15-Mar-2026 660 Views

Java and C are two popular programming languages with different features, syntax, and applications. Java was first introduced by Sun Microsystems in 1995 and operates on the Java Virtual Machine (JVM). C is a procedural programming language developed by Dennis Ritchie at Bell Labs in 1972. Both Java and C have their pros and cons, but here we will explore how Java is better than C in various aspects. Memory Management One of the notable distinctions between Java and C is in memory management. C uses manual memory management, which requires the programmer to allocate and deallocate memory ...

Read More

Locate unused structures and structure-members

Satish Kumar
Satish Kumar
Updated on 15-Mar-2026 1K+ Views

Structures in C are user-defined data types that group related variables together. As codebases grow, some structures and their members may become unused, leading to cluttered code and wasted memory. This article explores methods to identify and remove unused structures and structure members in C programs. Syntax struct structure_name { data_type member1; data_type member2; // ... more members }; Why Remove Unused Structures and Members? Unused structures and members can impact performance and readability of your code. Here are some reasons why ...

Read More

Corrupt stack problem in C, C++ program

Satish Kumar
Satish Kumar
Updated on 15-Mar-2026 3K+ Views

The corrupt stack problem is a critical runtime issue in C programming that occurs when the program's stack memory becomes compromised. This can lead to unpredictable program behavior, crashes, and security vulnerabilities. Understanding stack corruption is essential for writing robust C programs. What is a Stack in C? In C, the stack is a region of memory used for automatic storage of local variables, function parameters, and return addresses. It operates on a Last-In-First-Out (LIFO) principle, where the most recently allocated memory is freed first when functions return. What is Corrupt Stack Problem? Stack corruption occurs ...

Read More

C program to implement CHECKSUM

Satish Kumar
Satish Kumar
Updated on 15-Mar-2026 10K+ Views

In computing, a checksum is a small-sized data value computed from a larger data set using an algorithm, with the intention that any changes made to the larger data set will result in a different checksum. Checksums are commonly used to verify the integrity of data during transmission or storage. Syntax unsigned int checksum(char *data); // Returns computed checksum value for given data Why Use CHECKSUM? There are several reasons why checksums are used − Error detection − Detect errors that occur during data transmission or storage Data integrity − Ensure data ...

Read More

fopen() for existing file in write mode in C

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 2K+ Views

The fopen() function in C is used to open files for various operations. When opening an existing file in write mode, it's important to understand how different modes affect the file's content. Syntax FILE *fopen(const char *filename, const char *mode); fopen() for an Existing File in Write Mode When using fopen() with write mode on an existing file − 'w' mode: Creates a new file if it doesn't exist, or truncates (empties) an existing file before writing 'w+' mode: Same as 'w' but allows both reading and writing 'a' mode: Appends new ...

Read More

C Program to Redeclaration of global variable

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 851 Views

In C programming, variable redeclaration refers to declaring a variable more than once in the same scope. The behavior of redeclaration varies between global and local variables, and differs between C and C++. Understanding these differences is crucial for avoiding compilation errors. Syntax // Global variable redeclaration int var; int var; // Allowed in C without initialization // Local variable redeclaration int main() { int var; int var; // Not allowed in C } Global Variable Redeclaration Without Initialization C allows ...

Read More

C program to demonstrate usage of variable-length arrays

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 389 Views

Variable-length arrays (VLAs) in C allow you to create arrays whose size is determined at runtime rather than compile time. This feature was introduced in C99 and provides dynamic array allocation on the stack. In this example, we'll demonstrate a library system that uses VLAs to manage books on shelves with three operations: adding books, querying book pages, and counting books per shelf. Syntax data_type array_name[variable_size]; // Where variable_size is determined at runtime Library Management System The system supports three commands − Command 1: Insert a book with y pages at shelf ...

Read More
Showing 21–30 of 953 articles
« Prev 1 2 3 4 5 96 Next »
Advertisements