C (lugha ya programu)

C ni lugha ya programu. Iliundwa na Dennis Ritchie na ilianzishwa tarehe 1 Januari 1972. Iliundwa ili kuumba mifumo ya uendeshaji. Leo tunatumia C 18. Ilivutwa na FORTRAN.

C
The C Programming Language logo
Shina la studio namna : namna ya utaratibu
Imeanzishwa Januari 1 1972 (1972-01-01) (umri 52)
Mwanzilishi Dennis Ritchie
Ilivyo sasa Ilivutwa na: B (BCPL, CPL), ALGOL 68, Assembly, PL/I, FORTRAN

Ilivuta: AMPL, AWK, csh, C++, C--, C#, Objective-C, D, Go, Java, JavaScript, Julia, Limbo, LPC, Perl, PHP, Pike, Processing, Python, Ring, Rust, Seed7, Vala, Verilog (HDL), Nim

Mahala Dennis Ritchie & Bell Labs; ANSI X3J11 (ANSI C); ISO/IEC JTC1/SC22/WG14 (ISO C)
Tovuti https://www.learn-c.org

Inaitwa C kwa sababu ni mageuzi ya B, lugha ya programu nyingine.

Historia

hariri

Ilianzishwa 1 Januari 1972 nchini Marekani. Lakini Dennis Ritchie alianza kufanya kazi kuhusu C mwaka wa 1970.

Falsafa

hariri

Namna ya C ni namna ya utaratibu kinyume cha lugha za programu nyingi.

Sintaksia

hariri

Sintaksia ya C ni ngumu sana kinyume cha lugha za programu nyingine kama JavaScript, Python au Ruby. Ilivutwa na sintaksia ya B, lugha ya programu nyingine.

Mifano ya C

hariri

Programu kwa kuchapa « Jambo ulimwengu !».

#include <stdio.h>

int main(void)
{
    printf("Jambo ulimwengu !\n");
}

Programu kwa kutafuta factoria ya namba moja.

    #include <stdio.h>
    int main() {
        int n, i;
        unsigned long long fact = 1;
        printf("Enter an integer: ");
        scanf("%d", &n);
        // shows error if the user enters a negative integer
        if (n < 0)
            printf("Error! Factorial of a negative number doesn't exist.");
        else {
            for (i = 1; i <= n; ++i) {
                fact *= i;
            }
            printf("Factorial of %d = %llu", n, fact);
        }
        return 0;
    }

Marejeo

hariri
  • Ritchie, Dennis M. (1993). The Development of the C Language. The Second ACM SIGPLAN History of Programming Languages Conference (HOPL-II). Cambridge, MA, USA — April 20–23, 1993: ACM. pp. 201–208. doi:10.1145/154766.155580. ISBN 0-89791-570-4. Retrieved 2014-11-04.
  • Kernighan, Brian; Ritchie, Dennis (1988). The C Programming Language (2 ed.). Prentice Hall. ISBN 978-0131103627. (archive)
  • Plauger, P.J. (1992). The Standard C Library (1 ed.). Prentice Hall. ISBN 978-0131315099. (source)
  • Banahan, M.; Brady, D.; Doran, M. (1991). The C Book: Featuring the ANSI C Standard (2 ed.). Addison-Wesley. ISBN 978-0201544336. (archive)
  • Harbison, Samuel; Steele Jr, Guy (2002). C: A Reference Manual (5 ed.). Pearson. ISBN 978-0130895929. (archive)
  • King, K.N. (2008). C Programming: A Modern Approach (2 ed.). W. W. Norton. ISBN 978-0393979503. (archive)
  • Perry, Greg; Miller, Dean (2013). C Programming: Absolute Beginner's Guide (3 ed.). Que. ISBN 978-0789751980.