Advertisement
 

C Programming

  • - Featured
Quiz
Assignments
  • - Table of Contents



C is a general-purpose, procedural programming language that Dennis M. Ritchie initially created to create Bell Labs ' UNIX operating system. In 1972, C was first introduced on the DEC PDP-11 computer. In 1978, the first publicly available description of C, now known as the K&R standard, was produced by Brian Kernighan and Dennis Ritchie. The UNIX operating system, the C compiler, and most of the UNIX application programs were published in C. C has now become a commonly used professional language for multiple purposes − Easy to learn Structured language It generates effective programs It can manage low level operations It can be compiled on a multitude of computer systems

Facts about C

Why use C?

Initially, C was used to develop the system, especially the programs that make up the operating system. C was accepted as a language for system implementation because it generates code that operates almost as quickly as the assembly language code. Some instances of C use may be −

C Programs
A C program can differ from 3 lines to millions of lines and should be entered into one or more text files with ".c" extension ; hello.c, for instance. To enter your C program into a file, you can use "vi," "vim" or any other text editor.

Check your knowledge:


  1. What is C language?
  2. C is a mid-level and procedural programming language. A technique in which large programs are divided into smaller modules and each module uses structured code is also known as the Procedural programming language. Misunderstanding and error are minimized by this technique.

  3. Why is C known as a mother language?

    Because most compilers and JVMs are written in C, C is considered a mother tongue. Most of the languages developed after C were heavily borrowed from it like C++, Python, Rust, Javascript, etc. It presents fresh key ideas that are used in these languages, such as arrays, features, file handling.

  4. Why is C called a mid-level programming language?

    C is called a programming language of mid-level because it links the programming language of low and high-level. We can use C language as a system programming to create the operating system and an application programming to create a menu-driven billing system oriented by the client.

  5. Who is the founder of C language?

    Dennis Ritchie.

  6. When was C language developed?

    C language was developed in 1972 at bell laboratories of AT&T. More details.

  7. What are the features of the C language?

    The main features of C language are given below:

    • Simple: C is a simple language because it follows the structured approach, i.e., a program is broken into parts

    • Portable: C is highly portable means that once the program is written can be run on any machine with little or no modifications.

    • Mid Level: C is a mid-level programming language as it combines the low- level language with the features of the high-level language.

    • Structured: C is a structured language as the C program is broken into parts.

    • Fast Speed: C language is very fast as it uses a powerful set of data types and operators.

    • Memory Management: C provides an inbuilt memory function that saves the memory and improves the efficiency of our program.

    • Extensible: C is an extensible language as it can adopt new features in the future.

  8. What is the use of printf() and scanf() functions?
    • printf(): The printf() function is used to print the integer, character, float and string values on to the screen.

    Following are the format specifier:

    • %d: It is a format specifier used to print an integer value.

    • %s: It is a format specifier used to print a string.

    • %c: It is a format specifier used to display a character value.

    • %f: It is a format specifier used to display a floating point value.

    • scanf(): The scanf() function is used to take input from the user.

  9. What is recursion in C?

    When a function calls itself, and this process is known as recursion. The function that calls itself is known as a recursive function.
    Recursive function comes in two phases

    1. Winding phase

    2. Unwinding phase

    Winding phase: When the recursive feature calls itself, and when the stage is reached, this stage finishes.
    Unwinding phase: When the condition is reached, the unwinding stage begins and the control returns to the initial call.

  10. What is the use of a static variable in C?

    Following are the uses of a static variable: A static variable is referred to as a static variable. The static variable retains its value between different function calls. Static variables are used because the range of the static variable throughout the program is available. So we can access a static variable wherever in the program. Initially, it initializes the static variable to zero. If we update the value of a variable, the updated value will be assigned. The static variable is used as a common value that is shared by all methods. The static variable is initialized only once in the memory heap to decrease memory usage.

  11. What is the use of the function in C?

    Uses of C function are:
    C characteristics are used to avoid our program from repeatedly rewriting the same code. C characteristics can be called any number of times from anywhere in our program. When a program is split into tasks, it is easy to track any portion of our program. C features provide the notion of reusability, i.e. break the large assignment into smaller assignments to make the C program more comprehensible.

Discussion