C Flashcards
What is C?
C is a general-purpose, procedural programming language developed by Dennis Ritchie in the early 1970s. It is widely used for system and application software.
What’s the difference between C and C++?
C is a procedural programming language, while C++ supports both procedural and object-oriented programming (OOP) features. C++ is an extension of C.
What is a complier?
A compiler is a tool that translates C source code into machine code or object code that the computer can execute.
What are header files in C?
Header files in C contain function declarations, macros, and definitions that can be included in multiple files using #include. Common examples are stdio.h, stdlib.h, etc.
What is the main() function in C?
The main() function is the entry point of every C program. It is where the execution of a C program begins.
What is #include <stdio.h>?</stdio.h>
It is a preprocessor directive that includes the standard input/output library, allowing the program to use functions like printf and scanf.
What is printf() used for?
printf() is used to print formatted output to the console.
What is scanf() used for?
scanf() is used for formatted input, allowing users to input values into variables.
What are variables in C?
Variables are containers that store data values. Each variable in C has a specific type which defines the kind of data it can hold.
The basic data types in C are:
int (integer)
float (floating-point numbers)
char (characters)
double (double-precision floating-point numbers)
What are pointers in C?
Pointers are variables that store memory addresses of other variables. They allow for dynamic memory allocation and manipulation of data at specific memory locations.
What is the purpose of return 0 in main()?
It indicates successful program execution. A return value of 0 typically means the program ran without errors.
What is a loop in C?
A loop is a control structure used to repeat a block of code multiple times. Common loops in C are for, while, and do-while loops.
What are conditional statements in C?
Conditional statements like if, else, and switch are used to execute different blocks of code based on whether a condition is true or false.
What is a function in C?
A function is a reusable block of code designed to perform a specific task. It is defined with a return type, function name, and parameters.
What is the difference between call by value and call by reference in C?
Call by value:
A copy of the variable’s value is passed to the function, and changes made within the function do not affect the original variable.
Call by reference:
A reference (memory address) is passed to the function, allowing changes made within the function to affect the original variable.