# SDL: Modified points.c example from i++ to ++i for performance reasons and a good starting point for beginners to develop good...

**URL:** <https://discourse.libsdl.org/t/sdl-modified-points-c-example-from-i-to-i-for-performance-reasons-and-a-good-starting-point-for-beginners-to-develop-good/69259>\
**Category:** SDL Commits\
**Created:** [September 8, 2026, 10:00pm UTC](https://discourse.libsdl.org/t/sdl-modified-points-c-example-from-i-to-i-for-performance-reasons-and-a-good-starting-point-for-beginners-to-develop-good/69259 "2026-09-08T22:00:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [September 8, 2026, 10:00pm UTC](https://discourse.libsdl.org/t/sdl-modified-points-c-example-from-i-to-i-for-performance-reasons-and-a-good-starting-point-for-beginners-to-develop-good/69259/1 "2026-09-08T22:00:36Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/8f8ed757bc94d2e097aab8c4c0f58b57dcee9871>

```diff
From 8f8ed757bc94d2e097aab8c4c0f58b57dcee9871 Mon Sep 17 00:00:00 2001
From: JustinChou <[EMAIL REDACTED]>
Date: Tue, 8 Sep 2026 13:09:39 -0700
Subject: [PATCH] Modified points.c example from i++ to ++i for performance
 reasons and a good starting point for beginners to develop good habits.

---
 examples/renderer/04-points/points.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/renderer/04-points/points.c b/examples/renderer/04-points/points.c
index d07b85b9a7cc3..521328f47ee67 100644
--- a/examples/renderer/04-points/points.c
+++ b/examples/renderer/04-points/points.c
@@ -50,7 +50,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
     SDL_SetRenderLogicalPresentation(renderer, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_LOGICAL_PRESENTATION_LETTERBOX);
 
     /* set up the data for a bunch of points. */
- for (i = 0; i < SDL_arraysize(points); i++) {
+ for (i = 0; i < SDL_arraysize(points); ++i) {
         points[i].x = SDL_randf() * ((float) WINDOW_WIDTH);
         points[i].y = SDL_randf() * ((float) WINDOW_HEIGHT);
         point_speeds[i] = MIN_PIXELS_PER_SECOND + (SDL_randf() * (MAX_PIXELS_PER_SECOND - MIN_PIXELS_PER_SECOND));
@@ -78,7 +78,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
     int i;
 
     /* let's move all our points a little for a new frame. */
- for (i = 0; i < SDL_arraysize(points); i++) {
+ for (i = 0; i < SDL_arraysize(points); ++i) {
         const float distance = elapsed * point_speeds[i];
         points[i].x += distance;
         points[i].y += distance;

```
