C-Language Interview Questions
“C” is a structured oriented programming language developed at “AT & T Bell Laboratories of USA” in 1972.  It was developed by Dennis Ritche in late 1970’s. It began to replace the more familiar languages of that time like PL/1, ALGOL etc.
The main features of C language are given below :

Simple
Portable
Mid Level
Structured
Fast Speed
Memory Management
Extensible
printf() function : The printf() function is used for output. It prints the given statement to the console.

Syntax : printf("format string", list of variables);

scanf() function : This function is used to read values using keyboard. It is used for runtime assignment of variables.

Syntax : scanf("format string", list_of_addresses_of_Variables );
Local variable : A variable which is declared inside function or block is known as local variable.

Global variable :  A variable which is declared outside function or block is known as global variable.

int value=50;//global variable  
void function1(){  
int x=20;//local variable  
}  
Local variables scope is confined within the block or function where it is defined. Local variables must always be defined at the top of a block.

When a local variable is defined, it is not initialized by the system, you must initialize it yourself.

When execution of the block starts the variable is available, and when the block ends the variable 'dies'. It must be declared at the start of the block.

Example :

  void function1()
   {  
      int x=10; //local variable  
   } 
Global variable is defined at the top of the program file and it can be visible and modified by any function that may reference it.

Global variables are initialized automatically by the system when you define them.

If same variable name is being used for global and local variable then local variable takes preference in its scope. But it is not a good practice to use global 

variables and local variables with the same name.

Example :
  int value=20; //global variable  
  void function1()
   {  
     int x=10; //local variable  
   }
C data types are defined as the data storage format that a variable can store a data to perform a specific operation.
Data types are used to define a variable before to use in a program. Size of variable, constant and array are determined by data types.
There are four data types in C language. They are :

Basic data types : int, char, float, double
Enumeration data type : enum
Derived data type : pointer, array, structure, union
Void data type : void
A keyword is a reserved word. You cannot use it as a variable name, constant name etc. There are only 32 reserved words (keywords) in C language. No header file is needed to include the keywords are following :

Keywords : auto, break, case, char, const, continue, default, do, double, else, enum, extern, float, for, goto, if, int, long, register, return, short, signed, sizeof, static,  struct, switch, typedef, union, unsigned, void, volatile, while.
The symbols which are used to perform logical and mathematical operations in a C program are called C operators.
These C operators join individual constants and variables to form expressions. Operators, functions, constants and variables are combined together to form expressions.

The C language operators are following :

Arithmetic Operators
Assignment Operators
Increment and Decrement
Relational Operators
Logical Operators
Conditional Operators
Bitwise Operators
Special operators
C Arithmetic operators are used to perform mathematical calculations like, Addition (+), Subtraction (-), Multiplication (*), Division (/), Modulo Division (%).

Modulo division produces the remainder of an integer division. During modulo division, the sign of the result is always the sign of the first operand (the dividend).

Example :
- 14 % 3 = -2 
-14 % - 3 = 2

We see you’re using an ad blocker.

Our website is made possible by displaying ads to our visitors.

Please help us continue to provide you with free. So please disabling your ad blocker.