Questions tagged [imperative-programming]

Imperative programming is a paradigm of expressing the logic of a computer program or computation by explicitly describing its control flow in terms of statements that change a program state.

From Wikipedia:

In computer science, imperative programming is a programming paradigm that describes computation in terms of statements that change a program state. In much the same way that imperative mood in natural languages expresses commands to take action, imperative programs define sequences of commands for the computer to perform.

FAQ:

See also

143 questions
-2
votes
3 answers

Is Haskell an imperative or declarative paradigm?

I have read some sources where the Haskell's paradigm is described as functional but imperative paradigm. The main source where this is said is Wikipedia. How is possible a functional and imperative paradigm at the same time, or is this a mistake?
-3
votes
1 answer

Do you call it a Gator <,>?

What's the accepted name for "<" and ">"? I always used "open gator" and "close gator".
-3
votes
1 answer

What exactly is 'How to do and What to do' or 'Focus on results, not steps' in functional programming

I'm having a difficult time understanding the concept 'Don't think about How to do but What to do' (Focus on results, not steps) in functional programming. Let's say we have a language that treats functions as first class citizens and no inbuilt…
Prasad Weera
  • 1,223
  • 3
  • 13
  • 25
-3
votes
1 answer

Efficiency in Imperative programming and Functional programming

I have a question about the performance of IP and FP. Let's say I have a function to compute nth Fibonacci number. In imperative programming I have a choice to computing the nth Fibonacci number using iterative way, recursion, or dynamic…
-3
votes
5 answers

Declarative Language

I was reading an article on Declarative Programming Languages. If I don't understand the qualities of this type/paradigm of programming languages and it's contrast to Imperative languages, should I just read up on programming in this type of…
-4
votes
1 answer

Why is functional-styled code so much faster than imperative code in C?

I've been working on an algorithm for calculating maximum depth of an expression (i.e. how many nested parentheses there are) in various languages just for fun/practice. I noticed there's a huge performance discrepancy in the performance of the…
-7
votes
3 answers

C: How do I forward the return value of a function in another function?

I'm currently trying to write a program in C with the following structure: int alpha() { blablabla... //returns 0,1,2,3,4 or 5 depending on input } int beta() { blablabla... //needs to return the value that alpha returns } How - if…
confus
  • 3
-10
votes
1 answer

C++ Part of brute-force knapsack

reader, Well, I think I just got brainfucked a bit. I'm implementing knapsack, and I thought about I implemented brute-force algorithm like 1 or 2 times ever. So I decided to make another one. And here's what I chocked in. Let us decide W is maximum…
1 2 3
9
10