Nguồn: Click here
- What is the difference between a variable and a constant in C?
A variable is a storage location that can hold different values at different times, while a constant is a fixed value that cannot be changed.
- What is the difference between a global variable and a local variable in C?
A global variable is a variable that is declared outside of any function and can be accessed by any function in the program. A local variable is a variable that is declared inside a function and can only be accessed within that function.
- What is the difference between a #define and a const in C?
#define is a preprocessor directive that is used to define a constant value, while const is a keyword that is used to define a variable as a constant.
- What is the difference between a while loop and a for loop in C?
A while loop repeatedly executes a block of code as long as a given condition is true, while a for loop is used to execute a block of code a specific number of times.
- What is the difference between a switch statement and an if-else statement in C?
A switch statement is used to execute a block of code based on the value of a single expression, while an if-else statement is used to execute a block of code based on the evaluation of one or more conditions.
- What is the difference between a pointer and an array in C?
A pointer is a variable that stores the memory address of another variable, while an array is a collection of variables of the same type.
- What is the difference between call by value and call by reference in C?
In call by value, a copy of the value of a variable is passed to a function, while in call by reference, the memory address of a variable is passed to a function.
- What is the difference between a struct and a union in C?
A struct is a collection of variables of different types, while a union is a collection of variables of the same type.
- What is the difference between the ++ and -- operators in C?
The ++ operator increments the value of a variable by 1, while the -- operator decrements the value of a variable by 1.
- What is the difference between the = and == operators in C?
The = operator is used to assign a value to a variable, while the == operator is used to compare the values of two variables.
- What is the difference between the & and && operators in C?
The & operator is a bitwise operator used to perform a bitwise AND operation, while the && operator is a logical operator used to perform a logical AND operation.
- What is the difference between the | and || operators in C?
The | operator is a bitwise operator used to perform a bitwise OR operation, while the || operator is a logical operator used to perform a logical OR operation.
- What is the difference between the * and -> operators in C?
The * operator is used to dereference a pointer, while the -> operator is used to access a member of a struct through a pointer.
- What is the difference between the sizeof and strlen functions in C?
The sizeof function returns the size of a variable or data type in bytes, while the strlen function returns the length of a string in characters.
- What is the difference between the malloc and calloc functions in C?
The malloc function is used to allocate memory on the heap, while the calloc function is used to allocate
- What is the difference between C and C++?
C is a procedural programming language, while C++ is a combination of both procedural and object-oriented programming languages.
- What is the purpose of the main() function in C?
The main() function is the entry point of a C program, where the execution of the program begins.
- How do you define a variable in C?
Variables in C are defined using the keyword int, float, double, char, or void followed by the variable name.
- What is the difference between #include and #define in C?
The #include directive is used to include header files in a program, while the #define directive is used to define constants and macros.
- What is the difference between call by value and call by reference in C?
Call by value passes a copy of the value of the variable to the function, while call by reference passes the memory address of the variable to the function.
- What is the difference between a while loop and a do-while loop in C?
A while loop checks the condition before executing the loop, while a do-while loop executes the loop first and then checks the condition.
- What is the difference between a for loop and a while loop in C?
A for loop has a built-in counter that increments or decrements after each iteration, while a while loop does not.
- What is the purpose of the break statement in C?
The break statement is used to exit a loop or a switch statement.
- What is the purpose of the continue statement in C?
The continue statement is used to skip the current iteration of a loop and move on to the next iteration.
- What is the difference between single quotes and double quotes in C?
Single quotes are used to define a single character, while double quotes are used to define a string of characters.
- What is the difference between the == operator and the = operator in C?
The == operator is used for comparison, while the = operator is used for assignment.
- What is the purpose of the sizeof operator in C?
The sizeof operator is used to determine the size of a variable or data type in bytes.
- What is the purpose of the ternary operator in C?
The ternary operator is used as a shorthand way of writing an if-else statement.
- What is the purpose of the switch statement in C?
The switch statement is used to execute a block of code based on the value of a variable or expression.
- What is the purpose of the goto statement in C?
The goto statement is used to transfer control to another part of the program.
- What is the difference between an array and a pointer in C?
An array is a collection of variables of the same data type, while a pointer is a variable that holds the memory address of another variable.
- What is the purpose of the malloc() function in C?
The malloc() function is used to dynamically allocate memory at runtime.
- What is the purpose of the free() function in C?
The free() function is used to release memory that was dynamically allocated using the malloc() function.
- What is the purpose of the return statement in C?
The return statement is used to exit a function and return a value to the calling function.
0 Nhận xét