Simple Neural Network example

Small examples in C that demonstrate C language principles and how to use the standard libraries.
Post Reply
yossik32
Posts: 70
Joined: Fri Jan 30, 2026 1:40 pm
Contact:

Simple Neural Network example

Post by yossik32 »

Beginner Neural Network in C — A Tiny Perceptron That Learns OR

this example teaches:

inputs
weights
bias
weighted sum
activation function
training from examples
error correction

What is the neural network doing?

This tiny network receives two inputs:

x1
x2

It computes:

sum = x1*w1 + x2*w2 + bias

Then it decides:

if sum >= 0 → output 1
otherwise → output 0

During training:

if the answer is wrong, the weights are adjusted a little
after many examples, the network learns the rule
Attachments
simple_neural_network.zip
(800 Bytes) Downloaded 1 time
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest