C language--introduction History 1970: b by Ken Thompson at at&t bell Lab



Yüklə 13,5 Kb.
tarix08.08.2018
ölçüsü13,5 Kb.
#61496


C language--Introduction


History

  • 1970: B by Ken Thompson at AT&T Bell Lab

  • 1972: C by Dennis Ritchie and Ken Tompson at At&T Bell Lab for UNIX

  • 1978: “The C Programming Language” by Brian Kernighan and Dennis Ritchie (K&R C)

  • 1988: ANSI C



The First Program

  • #include

  • main( ) { printf(“Hello, World!\n"); }



How to use printf()

  • printf("Hello");

  • printf("Hello\n");

  • printf("%d", b);

  • printf("The temperature is "); printf("%d", b); printf(" degrees\n");

  • printf("The temperature is %d degrees\n", b);

  • printf("%d + %d = %d\n", a, b, c);



How to use printf()

  • int (integer values) uses %d

  • float (floating point values) uses %f

  • char (single character values) uses %c

  • character strings (arrays of characters, discussed later) use %s



How to use scanf()

  • scanf("%d", &b);

    • int uses %d
    • float uses %f
    • char uses %c
    • character strings use %s
  • scanf("%d %d",&a, &b);



Yüklə 13,5 Kb.

Dostları ilə paylaş:




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə