Category Archives: Programming (en)

[C language] memcpy() function

I remember that when I saw the memcpy () function for the first time in the code, I did not understand what kind of unknown animal it was. No one even thought to write a comment that explains it (no, … Continue reading →

Posted in C language (en) | Leave a comment

[ C language] Symbolic I/O and Redirection (Chapter 8)

The eighth chapter in Steven Prata’s book “C Primer Plus” (in the new edition it is called “Character I/O and Input Validation”). EOF (end of file) – designation of the end of the file. Ctrl+Z on Windows, Ctrl+D on UNIX. … Continue reading →

Posted in C language (en) | Leave a comment

[C language ] Insidious newlines on input

While doing the last exercise in Chapter 7, I ran into a problem reading an input line if it contains a newline. Everywhere this is explained somewhat abstrusely, I will try on my fingers: The problem is that when you … Continue reading →

Posted in C language (en) | Leave a comment

[C language] Printf statement line break

I forgot how to properly “cut” long pieces of printf, so I decided to write this cheat sheet. Let’s say you have a long printf expression and you need to break it into several smaller ones for readability (or to … Continue reading →

Posted in C language (en) | Leave a comment

[C language ] Scanf character input (%d): infinite loop error

When completing tasks from the seventh chapter, for the first time I encountered a “pinched cycle”. Let’s say the user enters the character q into a field (don’t do this unless you have the ability to interrupt the program): #include … Continue reading →

Posted in C language (en) | 1 Comment

[C language] Programming Exercises (Chapter 7)

Tasks from the seventh chapter of Stephen Prata’s book “C Primer Plus” – “C Control Operators: Branching and Jumps”. 1. Write a program that reads input until a # character is encountered, and then displays the number of spaces read, … Continue reading →

Posted in C language (en) | Leave a comment

[C language] C Control Statements: Branching and Jumping (Chapter 7)

The seventh chapter in Stephen Prata’s C Primer Plus. I want to start with a suitable divisors.c program For a given integer, you need to print all the integers by which the given number is divisible without a remainder; if … Continue reading →

Posted in C language (en) | Leave a comment

[C language] Programming Exercises: Loops and Arrays (Chapter 6)

The long-awaited moment has come to do “homework” on the sixth chapter of Stephen Prata’s book “C Primer Plus”. We are waiting for as many as 18 exciting tasks. 1. Write a program that creates an array of 26 elements … Continue reading →

Posted in C language (en) | Leave a comment

[C language] Mysterious scanf and %c: enter a phrase, not a character

I want to share a separate post with a very non-trivial task from the point of view of a beginner in C. It is the eighth self-monitoring question in chapter 6 of Stephen Prat’s C Primer Plus. The task is: … Continue reading →

Posted in C language (en) | Leave a comment

[C language] Control Statements: Loops (Chapter 6)

Synopsis: The sixth chapter in Stephen Prata’s C Primer Plus. Loop with precondition: for (initialization; examination; update)           operator Initializing expression → test expression → corrective expression Loop with postcondition: do     operator while (expression) … Continue reading →

Posted in C language (en) | Leave a comment

Compiling in “Notepad++”

I got a little carried away using Borland 6 to learn C. Powerful program and all, but due to my age, the UI customization capabilities are at the level of a notebook (the same one). For example, you cannot change … Continue reading →

Posted in C language (en), IDE (en), Notepad++ (en) | Leave a comment

[C language] Program about grains on a chessboard (Chapter 5)

From the fifth chapter of Stephen Prata’s book “C Primer Plus” – a program based on a well-known proverb that illustrates exponential growth. Background: The king offered to choose a reward for the hero’s service; the hero asked to put … Continue reading →

Posted in C language (en) | Leave a comment

[C language] Operations, Expressions, and Operators (Chapter 5)

The fifth chapter in Stephen Prata’s C Primer Plus. It deals with statements and the while loop. Curiously, in Prat’s book, while comes before if/else in terms of presentation; while in programming, loops are often taught already after conditional statements. … Continue reading →

Posted in C language (en) | Leave a comment

[C Language] Character Strings and Formatted I/O (Chapter 4)

The fourth chapter in Stephen Prat’s C Primer Plus. Programming exercises and their solutions: 1. Write a program that asks for the first and last name and then outputs them in the format last name, first name.

Posted in C language (en) | Leave a comment

[C language] Data in C (Chapter 3)

The third chapter in Stephen Prata’s C Primer Plus. Programming exercises and their solutions: 1. Experiment with how your system handles integer and floating point overflows and floating point underflows; those. write a program that has such problems. (See the … Continue reading →

Posted in C language (en) | Leave a comment

[C language] Introduction to C language (Chapter 2)

The second chapter in Stephen Prata’s C Primer Plus. Here the first practical tasks already appear; albeit extremely simple, for memorizing the basic syntax; therefore, I will not give their output separately. Before the tasks, a small reminder: 5 Types … Continue reading →

Posted in C language (en) | Leave a comment

[C language ] Background (Chapter 1)

So, the first chapter in Stephen Prata’s book “C Primer Plus”. Since there are no exercises in it (only one, theoretical), I will give a small summary of the chapter for the purpose of familiarization: The advent of the C … Continue reading →

Posted in C language (en) | Leave a comment