SVET PROGRAMIRANJA
  • HOME
  • WEB PROGRAMMING
    • Popular programming languages today
    • Programming trends
    • Internet of things
    • Creating web application
    • Frontend and backend programming
    • Creating Simple Website >
      • Create Your Logo Home
      • Create Your Logo CSS
    • Creating python web application >
      • Creating a Django Web Application - Getting Started
    • ASP.NET CORE web application >
      • ASP.NET CORE web application introduce >
      • Servicing static web pages using a web server
      • Creation of a sql web api service that reads data from the database
      • Creating a controller in an asp.net web API application
      • Communication of the Javascript web application with the API server
  • Algorithms
    • Algorithms Guide
    • Mathematical algorithms >
      • Array of Fibonacci
      • A prime numbers and factoring
      • Eratosthenes sieve
      • The Euclidean algorithm
      • The maximum sum of subarrays
      • Fast exponentiation algorithm
    • Structures and Unions >
      • Introduction to structures and unions
      • Disjoint Set Union (DSU) structures
      • Basic data structures
    • Sorting arrays >
      • Merge-sort
      • Quick-sort
    • Binary search
    • Recursion and dynamic programming >
      • Recursive algorithms
        • Tower of Hanoi algorithm
      • Introduction to dynamic programming
      • DP: Fibonacci with memoization
      • DP: Knapsack problem – Explanation and examples
      • Longest Common Subsequence (LCS)
  • Examples in C,C++,Java
    • Basic Examples >
      • Data examples in C/C++
      • Selection statements in C/C++ - examples
      • Loops in C/C++ examples >
        • Loops in C/C++ examples basic
        • Nested loops in c and c++ examples
      • Arrays in C/C++ examples
      • Strings in C/C++ examples
      • Sorting arrays in C/C++ examples
      • Two dimensional arrays in C/C++ - examples
      • Functions in C/C++ - examples
      • Algorithms examples >
        • Recursive algorithms examples
    • Additional examples with solutions >
      • Data in C - additional examples
      • Selection statement - additional
      • Loop - additional
      • Clasess and objects- additional
    • Preparations for competitions in informatics >
      • Preparations for qualifications for distict competitions
      • Qualifications for distict competitions
      • Preparation for the national competition
    • Tests >
      • Test from "Selections statements"
  • Programming languagages
    • Learn C >
      • Introducing to C and C++
      • Basics about C and C++
      • Data in languages C
      • Operators in C/C++
      • Selection Statements in C/C++
      • Loops in C/C++ >
        • Loops in C/C++ basic
        • Nested loops in c and c++
      • Arrays in c and cpp >
        • Onedimensional Array in c and c++ basic
        • Vectors in c and c++
        • Two-dimensional array-matrix in c and c++
        • Maps in c and c++
      • Strings in C/C++
      • Two-dimensional arrays
      • Pointers in C/C++
      • Functions in C
    • learn C++ >
      • Introducing to C++
      • Data in C++
      • Operators in C++
      • Selection Statements in C++
      • Loops in C++ >
        • Loops in C++ basic
        • Nested loops in c++
      • Arrays in c++ >
        • Introduction to an Array in c++
        • Vectors in c++
        • Two-dimensional array-matrix in c++
        • Maps in c++
        • Two dimensional dynamic arrays in c++
      • Strings in C++
      • Two-dimensional arrays
      • Pointers in C++
      • Functions in C++
    • Learn JAVA >
        /*JAVA*/
      • Introducing to JAVA
      • Java Basic >
        • Data in JAVA programming
        • Selections statements in JAVA
        • Operators in JAVA
        • Loops in JAVA
        • Arrays in JAVA
      • Object oriented programming >
        • Understanding Java as an Object-Oriented Language
        • Classes and Objects
        • Inheritance of classes
        • Abstract classes and interfaces
        • The visual part of the application >
          • Graphical user interface
          • Events in Java
          • Drawing in window
          • Graphics in JAVA-example
          • Animations in JAVA-examples
          • Applications in JAVA-examples
      • Distance learning java
    • Learn Processing >
      • Intoduction to processing
      • Basic of processing using JAVA
      • Processing and microbit
      • Using vectors in Processing >
        • Vector operations application
      • Processing 2D >
        • Creating Projectile motion animation
        • Processing example: Soccer game shoot
        • Body sliding down a inclined plane
        • Analisys of an inclined plane
        • Circular motion animation in processing
      • Processing 3D >
        • Introducing to 3D processing
        • Movement of 3D objects in processing
    • Arduino and ESP32 programming >
      • Learn Arduino Programming >
        • Intoduction to arduino
        • LDR sensor(light sensor) exercises
        • Arduino temperature sensor - exercises
        • Measuring an unknown resistor
        • Arduino -Ultrasonic sensor
        • introduction to servo-motors on arduino
        • Moisture soil sensor
      • Learn ESP32 Programming >
        • Intoduction to ESP32
        • ESP32 with servo motors exercise
  • MORE
    • Privacy Policy
    • Links
    • Distance learning

Srpski | English

Data in languages C

Learning Objectives

​Understand basic data types, when to use fixed-width types, and how to group data with structs, unions, and enums.
​Programming in C enables computers to process a variety of data, such as numbers, text, and more complex types. To handle data effectively, memory must first be allocated, and data types like int, float, or char define the size and nature of this memory allocation. Each type specifies how much space is required and which operations are valid. By clearly defining data and its type, a program efficiently manages memory, enabling complex data manipulation and processing.
​Writing a program (application) aims to perform some minor or major task set as a request to the programmer. It can be an application for processing text, music, games, complex programs for managing processes in industry, medicine, applications that are used in scientific research, etc. All these applications have some kind of data processing in their background to a greater or lesser extent. In order for the created application to be able to process the data, it must be connected to the memory in some way. So, for that data, it is necessary to first reserve the memory through the compiler, and then access that memory one or more times in order to enter the data, either by the programmer or by the user of the program. After processing the data, using expressions and formulas, it may be necessary to reinsert the processed data into the same or different memory.
In order to manage these processes through program commands, it is necessary to mark that data in some way (give it a name). It is also necessary to define a data type for each data. For example the compiler needs to know what kind of data it is, whether it is an integer or a real number, a letter, a logical type, a text or perhaps some complex data type. This is necessary in order to know, based on the type, how much memory should be reserved, which set of operations is allowed on such data. The official "C" language words given later in the table are usually used to represent data types, e.g. int, float, double etc.
In order to reserve memory (defined data) for e.g. an integer should be written command:
int a;
​where the first word represents the data type, and the second the data name. Therefore, the definition of the data is required according to the following template, with the note that it is about simple data.
​data_type data_name;

Data types

Data is subject to processing in programs. Each data has certain properties and data type.

The data type is determined by a set of values that the data can take and a set of operations that can be performed on the data.

Data type Description Memory (bits) Typical Size (bytes)
char Short integer data. Used to store characters 8 1
short Short integer data 16 2
int Integer data 16 or 32 2 or 4
long Long integer data 32 4
float Single precision floating point 32 4
double Double precision floating point 64 8
int8_t Fixed-width 8-bit signed integer (C99/C11) 8 1
uint32_t Fixed-width 32-bit unsigned integer (C99/C11) 32 4
_Bool / bool Boolean type (C99 ``) — true or false 8 1

Types of Data

Variables

  • They can change the value during the program
  • Memory must be reserved
  • Example: int a; // the memory for integer data is allocated

Constants

  • No memory is saved
  • They are used in expressions
  • Example: Y = 2 * X; // 2 is a constant

Symbolic Constants

  • Constants represented by an identifier
  • Example:
  • #define PI 3.14
    P = r * r * PI;

Constant Data

  • Memory is allocated
  • Data must be initialized
  • The value does not change during the program
  • Example: const double e = 2.71828;
The data type defines the set of possible values that a variable can hold and the operations that can be performed on it. It also determines how much memory will be reserved for storing that data. Each type occupies a specific amount of memory.
There are several categories of data types:
  • Primitive data types
  • Derived data types
  • Void type
  • Enumeration types

​Primitive data types

The following data types are used in the C and C++ programming language:
Integer data type:

  • short              16 bits               short integer data
  • int                  16 or 32 bits      integer data                            Note: It depends on the architecture and the compiler
  • long               32 bits                long integer data
  • long long       64 bits               long long integer data
​
Longer integer data may contain larger numbers because it uses more memory to store values. It is easy to calculate the maximum number that can be placed in eg long long. This would be in binary form a number containing 64 times 1. Eg. 111111 ....​

so that would be a number 263+262 +...+20 =18446744073709551615

Example:

int a;

int b;


Reading and Writing a Serial Number with uint32_t

Use a 32-bit unsigned integer to store device serial numbers that may exceed the range of a default int. Below is a minimal example showing how to read a serial number from EEPROM and send it over Serial.


// Include EEPROM library to store persistent data
#include <EEPROM.h>

const int SERIAL_ADDR = 0;           // EEPROM address for the serial number
uint32_t deviceSerial = 0;

void setup() {
  Serial.begin(9600);

  // Read four bytes from EEPROM into the 32-bit serial
  deviceSerial = 0;
  for (int i = 0; i < 4; i++) {
    deviceSerial |= (uint32_t(EEPROM.read(SERIAL_ADDR + i)) << (8 * i));
  }

  // Print the retrieved serial number
  Serial.print("Device Serial: ");
  Serial.println(deviceSerial);

  // Example: increment and store a new serial
  deviceSerial++;
  for (int i = 0; i < 4; i++) {
    EEPROM.write(SERIAL_ADDR + i, (deviceSerial >> (8 * i)) & 0xFF);
  }
}

void loop() {
  // Application code here...
}

Warning: Mixing fixed-width types like uint32_t with default int can lead to unexpected conversions or overflow. Always match literal constants (e.g., use 0xFFUL) and cast appropriately when shifting or combining bytes.

​The byte size can be obtained by using the sizeof operator. The following code illustrates the use of the sizeof operator and the application to determine the size of data types.
​
​
Floating point data: 
  • float               32byts                single floating point
  • double           64 bits                double floating point
single floating point type can memorize fewer decimals so less precision than double floating point.

Boolean Usage: Modern vs. Legacy Style

In modern C99/C++ code, bool can be tested directly. Legacy code often compared an integer to zero.


// Modern style using bool
bool flag = true;
if (flag) {
    // executes when flag == true
}

// Legacy style using int
int value = 1;
if (value != 0) {
    // executes when value is non-zero
}
    

Note that when printed with printf or Serial.println, a bool value appears as 1 (true) or 0 (false) unless formatted otherwise.

Logical type: To describe logical data in language C, int is used, that is, there is no specific type for it, but an integer data type is used so that a number less than or equal to 0 is treated as logical false (false) and a number greater than zero as logical truth (true). In C since version C99 there is _Bool and stdbool.h (bool), not just int.
Character type(char): Char type is used to describe characters, letters, numbers, white and special characters. This is actually an integer type that occupies a data memory of 1 byte.
Example code using character:

char c;

c='A';

printf(“ASCII code of character %c iznosi %d\n”,c,c);

Derived data types

The following derived types of data are used in C programming language:
​
Arrays : If a series of numbers of the same type is to be defined, e.g. We then define the integers as follows: 

int A[10];

This will provide memory for 10 elements of type int.
​

Pointers  type: If a pointer to a double data type is to be defined, then the pointer is defined and initialized as follows:

double a;

double *pA;;//Pokazivač na podatak tipa double

pA=&a;

​For more on pointers, see:​ Pointers in C
Of the derived data types, structures, unions, and functions are also used.
void type.
The C programming language uses the type void code of functions, when the function does not return any value. Then the official word c of the void language is used for the return value type.

Signed i unsigned data

​Signed data can have both positive and negative values while unsigned data is positive or zero. In C, the data is signed by default, and if you want to define the data as unsigned  in front of the type, the official word unsigned must be added. Examples of defining signed and unsigned integers:

int a;

signed int b;

unsigned int c;


The integer signed data, if int occupies 32 bits of memory are in the range from -231 to 231 or from -32767 to 32767,
but unmarked one are in the rank of 0-232 tj od 0-65535.

The first digit of the highlighted integers is used to specify the character (0-positive, 1-negative) while the remaining digits are used to show the value of the number. Therefore, the highest value of numbered numbers is 231 not 232. Other types, float, double, char can be signed and unsigned:

unsigned float x;

signed double y;

unsigned char z;


​Data type addendum


// Modern fixed-width integer types (C99/C11)
#include <stdint.h>
int8_t   smallNumber;   // exactly 8 bits
uint32_t largeNumber;  // exactly 32 bits

// Boolean type (C99 and later)
#include <stdbool.h>
bool      flag;      // true or false
_Bool     rawFlag;   // underlying type

// Structure example
typedef struct {
    int    id;
    float  value;
} Example;

// Union example
union Data {
    int    i;
    float  f;
};

// Enumeration example with auto-increment
enum Color {
    RED,       // 0
    GREEN,     // 1
    BLUE = 5, // explicitly set to 5
    YELLOW     // 6 (auto-incremented)
};
  

Structures, Alignment & Unions

1. Struct Example & Array Usage

Define a simple Point struct and create an array of points:

// Define a 2D point
struct Point {
    int x;
    int y;
};

// Create and initialize an array of points
Point polygon[3] = {
    {0, 0},
    {10, 0},
    {5,  5}
};

// Accessing elements
for (int i = 0; i < 3; i++) {
    printf("Point %d: (%d, %d)\n", i, polygon[i].x, polygon[i].y);
}
    

2. Padding & Alignment

By default, compilers may insert padding so each member aligns on its natural boundary. To pack tightly, #pragma pack can be used:

#pragma pack(push, 1)  // align members on 1-byte boundaries
struct PackedPoint {
    char  label;  // 1 byte
    int   x;      // 4 bytes
    int   y;      // 4 bytes
};
#pragma pack(pop)
    

3. Union Type-Punning Example

Unions allow interpreting the same memory in different ways—often used for fast conversion between types:

// Interpret a 32-bit float as an integer bit-pattern
union FloatInt {
    float    f;
    uint32_t u;
};

FloatInt value;
value.f = 3.14f;
printf("As int bits: 0x%08X\n", value.u);
    

Variables

As the word goes, they can change values throughout the program, which is why they are called variables. Memory is required for variables. We define the data by providing memory for it. The data declaration implies that we determine which type it is and give it a name. For simple data, the declaration is at the same time the definition of the data and is done as follows:
type_of_data  data_name;
For example. if two integers are concerned then the official word int is used for the data type and the data is defined as follows:

int a,b;// or in two rows

int a;

int b;


This reserves the memory for two integers. Memory status would be:

a

b

​Next, we assign some value to the data using the "=" assignment operator.

For more about operators in language c, see: Operators in C


This does not mean equality and does not apply to the left of the "=" sign as to the right. Here on the left there must be a memory that needs to get some value and on the right is that value or some expression whose result will be stored in the memory on the left. For example. assign some values to variables a and b:

a=14;

b=22;

After executing these two rows, the memory state would be:
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0

a

0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0

b

These are numbers 14 and 16 in binary form. For simplicity, we will look at numbers in memory as decadal numbers:
14

a

14

b

If we now introduce another integer variable c:

int c;

And we define the expression for summing the numbers a and b:

c = a + b;

memory status would be:
36

c

The number that is calculated is stored in memory and to display it requires some command that prints the value to the standard output (console).
This is a printf function from the stdio.h header in c (see read and write data below) or in c ++, the cout function from the iostream header can be used.
In the previous example, the programmer commanded a = 14; and b = 22; programmatically determined the values of a and b and the program user would not be able to influence them. In most cases, it is necessary to ensure that the user enters the values as they wish, and to do so, a command is provided that the number typed on the keyboard is temporarily memorized by the user as a string of characters and then converted with the appropriate input binary conversion. See data reading below.

Constant data

If the value does not change during the program, then such data is defined as the constant addition of the official word const. For example. the basis of the natural logarithm would be defined as follows:

const double e = 2.718281;

We see that there is also an assigned value here. This is mandatory when declaring, as this value will not continue to change during the program.

Constants

​These are values for example 2, 25, 3.14, 7f, 9.81f,… ..
They are not reserved memory, but are simply used in expressions. However, constants also have their own data type. For example, 2 is an integer constant of type int, 2. or 2.0 are of type double, while 2f would be of float type.

Symbolic constants​

These are constants given by the identifier. For example. instead of writing 3.14 in the expressions for pi, we can use the #define directive to define the symbolic constant PI as follows:

#define PI 3.14;

Then we could use this constant somewhere in expressions, e.g. for circle surface:

P = r * r * PI;

​For the compiler, this will still be the value defined by #define among the directives, but for developers, it is given an identifier, thus better suggesting the purpose of its use.

Header files

In order to use features from other files in a particular file, such a file must be included using the #include <file> directive.
We call these files header files. In C, they have the extension .h. For example. to be able to use the printf and scanf functions to write and read data to standard output, ie. input we need to include the stdio.h file:
#include <stdio.h>
Either you need to include the math.h file in c, or the cmath file in c ++ to use the math functions.
#include <math.h>
 
A useful site for viewing header files in c and c ++ is:http://www.cplusplus.com/reference/

Reading and writing data in C

​They are entered as a string of characters. Since the memory data is stored in binary form, the data conversion must be performed.
The stdio.h file must be included among the preprocessor directives
#define<stdio.h>
Celestial input conversion
scanf(format, &podatak,&podatak,....,&podatak)
The format is text data. Individual conversions are expressed in sub-formats:
% nq, where q is the conversion code, and n is a supplementary conversion parameter.
Input Conversions: i, d,u, o, x,.
for short:              hi,hd....
for long:                li, ld,...
Celestial output conversions: i, d,u, o, x,.
for short:              hi,hd....
for long:                li, ld,...
Input Real-Number Conversions:
for float:               f,e,g.
for double:           lf, le,lg
for long double:                 Lf, Le,Lg                
Output Real-Number Conversions:
for float:               f,e,g.
for double:           f, e,g

Output conversion​
In the previous example of summation, it remains to show how data from memory is displayed on the screen.
The stdio.h file provides a printf whose syntax is:
 
 printf(format,var1,var2,..);
 
In our example, this would be:​
 printf(“%d”,c);
 
After executing this command, the console would display:
Integer data-summation - output
Figure 1: Integer data-summation - output
Only result 36 is displayed.
If we would like to combine the output of the text and the number in the output, e.g. if we write "The sum of numbers 14 and 22 is 36", then the format parameter would actually be text with output formats for the output conversion for in this case integers "% d" or "% i". The parameters in the printf function, given after the format, are actually variables whose conversion is done, written in the order from left to right:

printf(“Sum of numbers %d and %d is %d”, a, b, c);

After starting at the exit it would be:
Integer data-summation extension - Example of output
Figure 2: Integer data-summation extension - Example of output
To allow the user to enter the desired values for a and b, we will use the scanf function from the stdio.h header.
 
Values for assigning values to variables a and b.

​a=14;
b=22;
 
should be replaced by:

scanf(“%d%d”, &a, &b);

​where% d is written twice the format for input conversion for integers, a & a and & b addresses of memory locations for data a and b.
The "&" operator provides the memory address of the data and is used for input and not for output conversion.
 
Before the scanf command, a printf command must be added to print a message, which tells the user what information to enter.
 
A complete task code would be:
Integer data-summation - a complete example
Figure 3: Integer data-summation - a complete example
Examples:
  • Enter the radius of the circle and calculate the area
  • Load trapeze pages and calculate area.
  • Load time in seconds and print as hh: mm: ss

Tasks Solutions 

​​Example 1-solution

We solve the problem in 4 steps:

First, we need to define the information we need: In the program, the user needs to enter the radius, and the program should calculate the area of ​​the circle. To define these data we will give them names and put the data type for real numbers (double). So the first command:

double r,P;


This is where we reserved the memory for two data of the double type we marked with r and with P

The second step is to enable the user to enter a semicolon. We use the method to enterscanf which is in the file stdio.h

We will include this file using the #include directive for inclusion of files, and this is written at the top of the document

#include < stdio.h >

There is still a method in this file printf for printing data and text on the console.

Before typing, we print a message on the console so that the user knows what to enter. For printing, we use the printf method, which actually represents the output conversion. The input conversion is done using the scanf method. This second step is:

 Circle area-steps

Figure 4: Circle area-steps

In the third step, we calculate the area using the known circle surface pattern. Multiplication requires the use of the "*" operator, while the symbolic constant is defined by the #define preprocessor directive at the top of the file.

In step 4, a message with the surface value, which is read from the memory marked in this program with P., is displayed. The %f format for double data is used for the output conversion.
Solution of the task
Figure 5: Solution of the task "Circle surface" - complete

Example 3-solution

​The problem is solved in 4 steps:
Here the user enters the time in seconds which should be an integer

int timeSek;

scanf(“%d”, &timeSek);

​To get minutes and hours from this number, we will use the operator % which gives the remainder of the division of two integers, as well as the operator "/" which gives the result of the division without the decimal part, that is, the whole number rounded to the first lower value. To get the number of whole hours in the total number of seconds we divide
time in seconds and 3600, timeSek/ 3600, and to get how many seconds left, we use "%", ie timeSek% 3600.
Code that does this:

int hh, restSek;

hh = timeSek / 3600;

restSek= timeSek % 3600;

​If the time was 7400s, h would be 2 hours, because 7500/2 = 2, if we round to the first smaller integer, while remaining unallocated 300s. This is the result of a wash of 7200% 3600 = 300;
Similarly they would get minutes from the remaining seconds (restSek), but in this case they would take 60 for the divider because 1min = 60 sec;

int mm;

mm = restSek/ 60;

restSek= restSek% 60;

The rest would now remain seconds that needed no further sharing. Finally, to display the time, we use printf formatted to display 2 digits for hours, minutes and time. In the case of single-digit numbers, it displays 0 as a prefix. So:

printf(“%02d : %02d : %02d”, hh, mm, restSek);

Complete code for this example:
Solution of the formatted time task
Figure 6: Solution of the formatted time task
After running:
Solution of the formatted-time-output task
Figure 7: Solution of the formatted-time-output task
The format % 02d, means the following,% is the start of inserting a variable value into the text, 2 is the number of digits to display, so if the number is a single digit it will be filled with a digit before 2, which in this example is "zero". "d" is the format label for decimal numbers.

Previous
​|< Basics C
Next
Operators in C​ 
​>|

Related articles

Data example in C/C++
​C Strings
Java programming
Algoritams-prime numbers
​Algoritams-arrays of Fibonacci
​
​
​
​
Algoritmi
Matrice
Java
Linkovi
​Politika Privatnosti
Kontakt



© 2025 by Slobodan svetprogramiranja.com

Sva prava zadržana

  • Home
  • WEB APPLICATIONS
    • Popular programming languages today
    • Programming trends
    • Internet of things
    • Creating web application
    • Frontend and backend programming
    • Creating Simple Website >
      • Create Your Logo Home
      • Create Your Logo CSS
    • Creating python web application >
      • Creating a Django Web Application - Getting Started
    • ASP.NET CORE web application >
      • ASP.NET CORE web application introduce >
      • Servicing static web pages using a web server
      • Creation of a sql web api service that reads data from the database
      • Creating a controller in an asp.net web API application
      • Communication of the Javascript web application with the API server
  • Algorithms
    • Algorithms Guide
    • Mathematical algorithms >
      • Array of Fibonacci
      • A prime numbers and factoring
      • Eratosthenes sieve
      • The Euclidean algorithm
      • The maximum sum of subarrays
      • Fast exponentiation algorithm
    • Structures and Unions >
      • Introduction to structures and unions
      • Disjoint Set Union (DSU) structures
      • Basic data structures
    • Sorting arrays
      • Merge-sort
      • Quick-sort
    • Binary search
    • Recursion and dynamic programming >
      • Recursive algorithms
        • Tower of Hanoi algorithm
      • Introduction to dynamic programming
      • DP: Fibonacci with memoization
      • DP: Knapsack problem – Explanation and examples
      • Longest Common Subsequence (LCS)
  • Examples in C,C++,Java
    • Basic Examples >
      • Data examples in C/C++
      • Selection statements in C/C++ - examples
      • Loops in C/C++ examples >
        • Loops in C/C++ examples basic
        • Nested loops in c and c++ examples
      • Arrays in C/C++ examples
      • Strings in C/C++ examples
      • Sorting arrays in C/C++ examples
      • Two dimensional arrays in C/C++ - examples
      • Functions in C/C++ - examples
      • Algorithms examples >
        • Recursive algorithms examples
    • Additional examples with solutions >
      • Data in C - additional
      • Selection statements - additional
      • Loop - additional
      • Clasess and objects- additional
    • Preparations for competitions in informatics >
      • Preparations for qualifications for distict competitions
      • Qualifications for distict competitions
      • Preparation for the national competition
    • Tests >
      • Test from "Selections statements"
  • Programming languagages
    • Learn C >
      • Introducing to C
      • Basics about C
      • Data in languages C
      • Data in C
      • Operators in C
      • Selection Statements in C
      • Loops in C >
        • Loops in C basic
        • Nested loops in c
      • Arrays in c >
        • Onedimensional Array in c basic
        • Two-dimensional array-matrix in c
      • Strings in C
      • Two-dimensional arrays
      • Pointers in C
      • Functions in C
    • learn C++ >
      • Introducing to C++
      • Data in C++
      • Operators in C++
      • Selection Statements in C++
      • Loops in C++ >
        • Loops in C++ basic
        • Nested loops in c++
      • Arrays in c++ >
        • Introduction to an Array in c++
        • Vectors in c++
        • Two-dimensional array-matrix in c++
        • Maps in c++
        • Two dimensional dynamic arrays in c++
      • Strings in C++
      • Pointers in C++
      • Functions in C++
    • Learn JAVA >
      • Introducing to JAVA
      • Java Basic >
        • Data in JAVA programming
        • Selections statements in JAVA
        • Operators in JAVA
        • Loops in JAVA
        • Arrays in JAVA
      • Object oriented programming >
        • Understanding Java as an Object-Oriented Language
        • Classes and Objects
        • Inheritance of classes
        • Abstract classes and interfaces
        • The visual part of the application >
          • Graphical user interface
          • Events in Java
          • Drawing in window
          • Graphics in JAVA-example
          • Animations in JAVA-examples
          • Applications in JAVA-examples
      • Distance learning java
    • Learn Processing >
      • Intoduction to processing
      • Basic of processing using JAVA
      • Processing and microbit
      • Using vectors in Processing >
        • Vector operations application
      • Processing 2D >
        • Creating Projectile motion animation
        • Processing example: Soccer game shoot
        • Body sliding down a inclined plane
        • Analisys of an inclined plane
        • Circular motion animation in processing
      • Processing 3D >
        • Introducing to 3D processing
        • Movement of 3D objects in processing
    • Arduino and ESP32 programming >
      • Learn Arduino Programming >
        • Intoduction to arduino
        • LDR sensor(light sensor) exercises
        • Arduino temperature sensor - exercises
        • Measuring an unknown resistor
        • Arduino -Ultrasonic sensor
        • Introduction to servo-motors on arduino
        • Moisture soil sensor
      • Learn ESP32 Programming >
        • Intoduction to ESP32
        • ESP32 with servo motors exercise
  • MORE
    • Privacy Policy
    • Links
    • Distance learning
SVET PROGRAMIRANJA

Podešavanja kolačića

Koristimo kolačiće da bismo vam pružili najbolje moguće iskustvo. Takođe nam omogućavaju da analiziramo ponašanje korisnika kako bismo stalno poboljšavali veb lokaciju za vas.

  • Početna
  • WEB APLIKACIJE
    • Popularni programski jezici danas
    • Klase za stil naslovne strane
    • Trendovi u programiranju
    • Internet stvari
    • Kreiranje web sajtova i web aplikacija >
      • Kreiranje web aplikacija
      • Kreiranje web aplikacija 2
      • ASP.NET Core web aplikacije >
        • ASP.NET Core web aplikacije uvod
        • Servisiranje statičkih web strana pomoću web servera
        • Kreiranje sql web api servisa koji čita podatke iz baze
        • Kreiranje kontrolera u asp.net web API aplikaciji
        • Komunikacija Javascript web aplikacije sa API serverom
      • Kreiranje web sajta >
        • Logo Kreator - naslovna
      • Kreiranje Django Web Aplikacije >
        • Kreiranje aplikacije na Heroku Web Platformi 2 >
          • Kreiranje Python Web Aplikacije-početak
        • Python Web Aplikacije
        • Logo Kreator - Kreiranje Naslovne strane
        • Django aplikacija i baza podataka
        • Kreiranje aplikacije na Heroku Web Platformi >
          • Dodavanje modula za registraciju >
            • Dodavanje web strane za logovanje
  • Algoritmi
    • Algoritmi početna - Učenje i Primeri
    • Matematički algoritmi >
      • Fibonačijev niz
      • Prosti brojevi i faktorizacija
      • Eratostenovo sito
      • Euklidov algoritam
      • Maksimalna suma podniza
      • Brzo stepenovanje
    • Strukture podataka >
      • Mapa učenja Strukture podataka
      • Uvod u strukture i unije
      • Uvod u vektore
      • Povezane liste
      • Stek (Stack)
      • Red(Queue)
      • Disjoint Set Union (DSU) strukture+
      • Osnovne strukture podataka
    • Sortiranje nizova >
      • Sortiranje objedinjavanjem
      • Brzo Sortiranje
    • Binarna pretraga
    • Rekurzija i dinamičko programiranje >
      • Rekurzivni algoritmi >
        • Hanojske kule
      • Uvod u dinamičko programiranje
      • Fibonacijev niz DP i memoizacija – objašnjenje i primeri
      • Osnovni DP obrasci >
        • DP: Problem ranca (Knapsack problem)
        • DP: Najduži zajednički podniz (LCS)
        • DP: Subset Sum -problem podskupa sa zadatom sumom
      • Napredni DP obrasci >
        • DP: Minimalan broj kovanica
        • Grid DP problem
        • Edit Distance DP
    • Zamena iteracija formulom
    • Grafovi i stabla >
      • Mapa učenja — Grafovi i stabla
      • Osnove i pretrage >
        • BFS i DFS (pretraga grafova)
        • Topološko sortiranje
        • Otkrivanje ciklusa u usmerenim grafovima
        • Najduži put u DAG-u (DP + topološko sortiranje)
      • Najkraći putevi >
        • Algoritmi grafovi Dijkstra-najkraći put
        • Bellman-Ford i Floyd-Warshall algoritmi
      • Minimalna stabla >
        • MST - Primov algoritam
        • Grafovi MST - Kruskalov algoritam
      • Grafovi Napredno >
        • Eulerovi putevi i ciklusi
        • Mostovi i Artikulisani čvorovi (Tarjanov algoritam)
        • SCC — Komponente jake povezanosti (Kosaraju i Tarjan)
        • DP na DAG-ovima — Primene
    • Napredne tehnike >
      • Podeli pa vladaj
      • Gramzivi algoritmi
  • Primeri - C,C++,Java,Python
    • Primeri iz programiranja – C, C++, Java, Python | Svet Programiranja
    • Osnovni primeri >
      • Podaci-primeri
      • Operatori-primeri
      • Grananje u programu - primeri
      • Petlje primeri >
        • Petlje - osnovni primeri
        • Ugnježdene petlje primeri
      • Stringovi - primeri
      • Nizovi primeri >
        • Nizovi-primeri
        • Sortiranje-primeri
        • Vektori i mape primeri
      • Matrice primeri
      • Funkcije u C/C++ jeziku -primeri
      • Primeri Algoritama >
        • Algoritmi-primeri >
          • Zamena iteracija formulom-primeri >
            • Nedostajući broj-uputstvo
        • Rekurzija-primeri >
          • Prvi i drugi na rang listi
        • Kombinatorika-primeri
        • Bektreking i gruba sila primeri
    • Dodatni primeri sa rešenjima >
      • Dodatni primeri sa rešenjima – algoritmi, petlje, grananje, OOP
      • Podaci i tipovi podataka-dodatni primeri
      • Dodatni primeri za vezbu - grananje u programu
      • Dodatni primeri iz petlji
      • Dodatni primeri za vezbu - Klase i objekti >
        • Ramovi za slike objekti-rešenje
        • Zadatak 2-Grupa radnika objekti
        • Salon Automobila rešenje
        • Zadatak 3. Kretanje automobila objekti-rešenje
        • Upravljanje porudžbinama u restoranu -rešenje zadatka
      • Kombinovani primeri za vezbu >
        • Zadatak 6-Interval-rešenje
    • Takmičenja-primeri >
      • Takmičenja primeri - vodič
      • Priprema za okružna takmičenja 1
      • Priprema za okružna takmičenja 2
      • Kvalifikacije za okružna takmičenja >
        • Datum sa najvećom zaradom-rešenje
        • Zbirovi nakon podele - rešenje
        • Zadatak Mešalica-rešenje
        • Zadatak Kuvar Rešenje
        • Zadatak Slovarica rešenje
        • Zadatak Note rešenje
        • Resenje zadatka Tačan Izraz
        • Zadatak Puž rešenje
        • Zadatak Seča Drva-rešenje
      • Opštinska takmičenja >
        • Zadatak Bejzbol Rešenje
      • Okružna takmičenja >
        • Zadatak Milioner rešenje
        • Zadatak Dve Slike Na Papiru
      • Priprema za državna takmičenja
      • Priprema za više nivoe takmičenja >
        • Priprema za drzavno takmičenje i SIO >
          • Zadatak Aritmetički trougao-rešenje
          • Obilazak konja-zadatak
          • Reči u mreži zadtak-rešenje
        • Interaktivni Algoritmi >
          • Zadatak Joker rešenje
          • Zadatak Boja rešenje
          • Zadatak Maksimizacija BTC
    • Objektno programiranje-primeri >
      • Klase i objekti - primeri
    • Testovi >
      • Testovi i kontrolni zadaci — vežbanje, mini-testovi i priprema
      • Kontrolni podaci
      • Kontrolni selekcije
      • Kontrolni petlje
      • Kontrolni - objekti i metode
      • Kontrolni Nizovi
  • Programski jezici
    • Programski jezici vodič
    • C >
      • C programski jezik
      • Uvod u programski jezik C
      • Elementi jezika C
      • Podaci u C jeziku
      • Operatori u C jeziku
      • Grananje u programu u C jeziku
      • Petlje u C programskom jeziku >
        • Petlje u programskom jeziku C
        • Ugnježdene petlje u C
      • Nizovi u jeziku C >
        • Nizovi u jeziku C
        • Dvodimenzionalni nizovi - matrice
        • Dvodimenzioni dinamički nizovi-matrice
      • C Stringovi
      • Pokazivači u C jeziku
      • Funkcije u C
    • C++ >
      • C++ programski jezik
      • Uvod u programski jezik C++
      • Podaci u C++ jeziku
      • Operatori u C++ jeziku
      • Grananje u programu u C++
      • Petlje u C++ programskom jeziku >
        • Petlje u programskom jeziku C++
        • Ugnježdene petlje u C++
      • Nizovi u C++ jeziku >
        • Nizovi u jeziku C++
        • Dinamički niz-vector
        • Rečnik podataka-mape u C++
        • Dvodimenzionalni nizovi - matrice u c++
        • Dvodimenzioni dinamički nizovi u c++
      • Stringovi u C++ jeziku
      • Pokazivači u C++
      • Funkcije u C++
    • C# >
      • C# – lekcije, primeri i vežbe
      • Uvod u C#
      • Kreiranje jednostavne aplikacije u C#
      • LINQ i Lambda izrazi u C#(Sharp)-u
      • Napredni C#(Sharp) primer
      • Konekcija sa bazom u C#-primer
      • Primer sa MySql bazom podataka
      • Kreiranje Windows Form App Sa SQLServer Bazom
    • JAVA >
      • Java – lekcije, primeri i zadaci
      • Uvod u Javu
      • Java osnove >
        • Podaci u JAVA programskom jeziku
        • Operatori u JAVI
        • Grananje u programu u programskom jeziku Java
        • Petlje u Javi
        • Nizovi u Javi
      • Objektno programiranje >
        • Klase i objekti
        • Metode i objekti
        • Nasleđivanje klasa
        • Apstraktne klase i interfejsi
      • Grafika u JAVI >
        • Grafika u Javi uvod
        • Grafički korisnički interfejs(GUI)
        • Događaji u JAVI
        • Crtanje u prozoru
        • Animacije u Javi-primer
        • Kreiranje 2D igrice u JAVI
        • Grafika u Javi-primer
        • Aplikacije u Javi-primeri
      • Simulacije u fizici >
        • Java i simulacije u fizici
        • Klase i objekti sa primenom u fizici
        • Upotreba ciklusa i nizova u simulacijama iz fizike
        • Primeri simulacija u EJS-u
    • Processing >
      • Processing – lekcije i primeri
      • Processing - uvod
      • Osnove processinga sa Javom
      • Processing i mikrobit
      • Vektori u Processing-u >
        • Opracije sa vektorima
      • Processing u 2D >
        • Kosi hitac u Processing-u
        • Primer kosog hica u processingu
        • Strma ravan u Processing-u
        • Analiza klizanja tela niz strmu ravan primer
        • Animacija Kružnog kretanja
      • Processing u 3D >
        • Uvod u 3D processing
        • Kretanje 3D objekata u processing-u
    • Arduino i ESP32 programiranje >
      • Arduino i ESP32 programiranje
      • Arduino programiranje >
        • Arduino Uno – Uvod
        • Arduino LDR Vežba-Prikaz osvetljenja
        • Arduino senzor temperature
        • DC motor-Upravljanje sa arduinom
      • ESP32 programiranje >
        • Uvod u ESP32
        • ESP32: Ultrazvučni senzor
        • ESP32-Primena kod servo motora
        • ESP32 Pokretanje pumpe za vodu
    • Python >
      • Uvod u python
      • Osnovni Python >
        • Python Osnovni Tutorijal — Početna za lekcije i primere
        • Python osnove >
          • Python za početnike – Instalacija i Prvi Program
          • Prvi program u python-u
          • Aritmetičke operacije u python-u
          • Mini projekti za početnike
          • Promenljive i tipovi podataka
          • Python input() — unos podataka za početnike
          • Formatiranje teksta-F string
          • Mini projekat-python
        • Kontrola toka programa >
          • Python grananje i logički operatori — if / elif / else
          • Grananje u Pythonu — if, elif, else | Svet Programiranjai
          • Mini zadaci- Temperatura i kviz
          • Petlje - while,for
          • Iteracije i osnovni algoritmi u Python-u
          • Mini zadaci — Petlje (for i while)
          • Nizovi i liste u python-u
          • Mini projekat: igra „Pogodi broj“
        • Funkcije i modularno programiranje >
          • Python funkcije
          • Python parametri i povratne vrednosti
          • Python opseg promenljivih
          • Modularno programiranje- moduli i import
        • Mini projekti i praktične vežbe >
          • Projekat: Pogodi broj
          • Mini projekat: Organizacija programa u module
          • Mini projekat — Brojač bodova i statistika
          • Mini projekat — Tekstualni meni
          • Mini projekat — Simulacija semafora
          • Završni mini projekat — Digitalni brojač
      • MycroPython(microbit) >
        • Micro:bit — MicroPython
        • Osnove programiranja (MicroPython) >
          • Uvod i osnovni programi >
            • Uvod u micropython
            • MicroPython: LED matrica — prikaz teksta i slika na micro:bit-u
            • MicroPython — Dugmad
          • MicroPython — Petlje i vreme
          • MicroPython – promenljive i funkcije
          • MicroPython – random i algoritmi
        • Senzori i ulazi >
          • MicroPython — Senzori
          • MicroPython: kompas i temperatura
          • MicroPython – dodatni senzori i aktuatori
        • Komunikacije i Projekti >
          • MicroPython: radio komunikacija
          • MicroPython: radio projekti
          • MicroPython: mini projekti
          • MicroPython – serial i Processing
      • Python + Processing >
        • Python i processing početna
        • Osnova i okruženje >
          • Python i Processing — uvod
          • Instalacija Processing 4
          • Prvi sketch — crtanje
        • Crtanje i grafika >
          • Oblici i boje
        • Animacija i interakcija >
          • Animacija i promenljive
          • Interakcija (miš i tastatura)
        • Mini projekti - igre >
          • Mini projekat: Pong
          • Pong u Pythonu — Score i Game Over
          • Pong sa 2 Igrača u Pythonu — Processing
          • Pong OOP u Pythonu — Modularna igra
          • Nizovi i liste — Python Processing
        • Vizuelizacija i projekti >
          • Crtanje grafikona — Python Processing
          • Interaktivni grafikon — Python Processing
        • Kreativni i takmičarski projekti >
          • Generativna umetnost
          • Projekti za takmičenja
          • Izvoz i prezentacija
      • Python za web
      • Projekti
    • Mikrobit i programiranje >
      • Microbit – Učenje programiranja za osnovce
      • Programiranje mikrobita snove >
        • Uvod u mikrobit
        • Naredbe u Makecode-u
        • Palete komandi Variables, Led. Temperatura i osvetljenje
        • Radio veza na mikrobitu
        • Upotreba promjenljivih i kontrolnih naredbi u programima
        • Kontrolne naredbe u programima mikrobita
        • Petlje-mikrobit
      • Programiranje mikrobita napredno >
        • Igrice i mikrobit
        • Mikrobit projekti i radionice
  • Politika Privatnosti
  • Linkovi
  • Učenje na daljinu
    • Učenje na daljinu-osnovci takmicari