Found 33676 Articles for Programming

C Program on two-dimensional array initialized at run time

Bhanu Priya
Updated on 08-Mar-2021 06:18:38

379 Views

ProblemCalculate the sum and product of all elements in an array by using the run-time compilation.SolutionA two-dimensional array is used in situations where a table of values have to be stored (or) in matrices applicationsThe syntax is as follows −datatype array_ name [rowsize] [column size];For example, int a[5] [5];Number of elements in array = rowsize *columnsize = 5*5 = 25ExampleFollowing is the C program to calculate the sum and product of all elements in an array by using the run-time compilation − Live Demo#include void main(){    //Declaring the array - run time//    int A[2][3], B[2][3], i, j, sum[i][j], product[i][j]; ... Read More

How to print the elements in a reverse order from an array in C?

Bhanu Priya
Updated on 08-Mar-2021 06:16:34

9K+ Views

Try to print the elements in reverse order by following an algorithm given below −Step1 − Declare an array of size 5Step 2 − Enter the 5 elements in memory using for loopStep 3 − Display elements in reverse orderBy decrementing for loopThe only logic is to reverse the elements is For loop −for(i=4;i>=0;i--){    //Displaying O/p//    printf("array[%d] :", i);    printf("%d", array[i]); }ExampleFollowing is the C program to reverse the elements − Live Demo#include void main(){    //Declaring the array - run time//    int array[5], i;    //Reading elements into the array//    printf("Enter elements into the array: ... Read More

Explain volatile and restrict type qualifiers in C with an example

Bhanu Priya
Updated on 08-Mar-2021 06:13:02

1K+ Views

Type qualifiers add special attributes to existing data types in C programming language.There are three type qualifiers in C language and volatile and restrict type qualifiers are explained below −VolatileA volatile type qualifier is used to tell the compiler that a variable is shared. That is, a variable may be referenced and changed by other programs (or) entities if it is declared as volatile.For example, volatile int x;RestrictThis is used only with pointers. It indicates that the pointer is only an initial way to access the deference data. It provides more help to the compiler for optimization.Example ProgramFollowing is the ... Read More

What are the C library functions?

Bhanu Priya
Updated on 25-Oct-2023 14:49:59

26K+ Views

Library functions are built-in functions that are grouped together and placed in a common location called library. Each function here performs a specific operation. We can use this library functions to get the pre-defined output. All C standard library functions are declared by using many header files. These library functions are created at the time of designing the compilers. We include the header files in our C program by using #include. Whenever the program is run and executed, the related files are included in the C program. Header File Functions Some of the header file functions are as follows − ... Read More

Functions in Rust programming language

Mukul Latiyan
Updated on 20-Feb-2021 08:09:31

282 Views

Functions are building blocks of code. They allow us to avoid writing similar code and also help in organizing large section of code into reusable components.In Rust, functions can be found everywhere. Even function definitions are also statements in Rust.One of the most important function in Rust is the main function, which is the entry point of any software or application.We make use of the fn keyword to declare a function in Rust.In Rust, the names of the functions make use of snake case as the conventional style. In snake case, all the letters of the word are in lower ... Read More

Rust programming language – Getting Started

Mukul Latiyan
Updated on 20-Feb-2021 06:53:00

360 Views

The first part of getting hands-on experience with Rust is installing Rust. In order to install Rust, we need a Rust installer.Rustup is a version management tool and also an installer that helps in installing Rust in your local machine.If you’re running Linux, macOS, or another Unix-like OS, then we simply need to run the following command in the terminal −curl --proto ‘=https’ --tlsv1.2 -sSf https://sh.rustup.rs | shThe above command will install Rust on your local machine.If you are on Windows, then you can download the .exe file from this link rustup-init.exeKeeping Rust UpdatedThough Rust is updated frequently, but you ... Read More

Why is Rust Programming language loved so much?

Mukul Latiyan
Updated on 20-Feb-2021 06:49:30

304 Views

Being voted as the most loved language for four consecutive years, Rust has come a long way.Originally designed as a low-level language, best suited for embedded, systems and critical performance code, it has gained a lot of traction and not stopping yet.Rust also has found its way in web developments and also provides a great opportunity for game developers.So, why is Rust so much loved? Let’s explore some of the reasons why it is so popular and loved.Fearless ConcurrencyConcurrency and parallelism have become more significant in today’s scenario. The number of cores is increasing in computers to support concurrency, but ... Read More

Downsides of Rust Programming Language

Mukul Latiyan
Updated on 20-Feb-2021 06:48:17

2K+ Views

Every programming language has some downsides attached to it, it’s not all roses when it comes to Rust as well. Some of the noticeable downsides of Rust programming language are highlighted here −Compile TimeYes, compile time. Rust is fast, no doubt. But when it comes to compiling code, then it’s a bit slower as compared to its peer languages. The reason for its slow compile time is that its “unit of compilation” is not an individual file, it’s instead a whole package (known as a crate). Crates in Rust can include multiple modules, thus they can be large units of ... Read More

Rust Programming Language – Big Features

Mukul Latiyan
Updated on 20-Feb-2021 06:46:04

341 Views

Rust packs in plenty of features that you can use to build highly scalable and memory‑safe applications and software. But some of these features are overarching features of the language.Here are some of the big features of Rust programming language −PerformanceWe know that the speed of the CPU is fixed, thus for any software to run faster, it needs to do less. To achieve this, Rust pushes the severe burden of its high-level features onto the compiler. Also, it doesn’t need a garbage collectorto ensure the safety.Rust’s object methods are always dispatched statically, unless one specifies that dynamic dispatch is ... Read More

Rust programming language – Applications

Mukul Latiyan
Updated on 20-Feb-2021 06:45:22

806 Views

Rust is a multi-paradigm language that can be used in many areas of development. It serves the system programming as the main domain, which these days can even include the web browsers and other software, even if they are user interface ones.That being said, let’s look at the areas of application where Rust programming language shines.Application ExtendingRust has in-built extensions for different commonly used languages like C++, Python and Java. These extensions make it much easier to extend any application code to Rust and hence allowing the developers to make use of Rust’s memory safety and other features which make ... Read More

Advertisements