Top 100 C Interview Questions and Answers
Updated 25 Jul 2025

Asked in Accenture

Q. Write code to find the length of a string without using the strlen() function.
Code to find length of string without using strlen() function.
Use a loop to iterate through each character of the string
Increment a counter variable for each character in the string
Stop the loop when the null character '\0' is encountered
Return the c...read more

Asked in TCS

Q. What is C code in Java?
C code in Java refers to the use of the Java Native Interface (JNI) to incorporate C code into Java programs.
C code in Java is typically used when performance optimization or low-level system access is required.
JNI allows Java programs to call C func...read more

Asked in Wipro

Q. Draw the flowchart for the following C program.
Flow chart for a C program
Identify the input and output
Determine the conditions and loops
Draw the flow chart accordingly

Asked in ReapMind Innovations

Q. How can we do web development using C?
Web development using C involves using frameworks like CGI, FastCGI, or libraries like libmicrohttpd.
Use frameworks like CGI or FastCGI to handle HTTP requests and responses.
Utilize libraries like libmicrohttpd for creating web servers in C.
Implement...read more

Asked in American Megatrends

Q. Data structures through c language
Data structures in C language are essential for organizing and manipulating data efficiently.
Data structures like arrays, linked lists, stacks, queues, trees, and graphs are commonly used in C programming.
Arrays are used to store a collection of elem...read more

Asked in Samsung

Q. What are storage classes in C? Explain.
Storage classes in C define the scope and lifetime of variables.
There are four storage classes in C: auto, register, static, and extern.
Auto variables are local to a block and have automatic storage duration.
Register variables are stored in CPU regis...read more

Asked in Samsung

Q. Write a C program that will compile and run to reverse a string in-place.
A C program to reverse a string in-place
Use two pointers, one pointing to the start of the string and the other to the end
Swap the characters at the two pointers and move them towards each other until they meet
Repeat the swapping process until the en...read more

Asked in Brigosha Technologies

Q. What are the key features of the static storage class?
Static storage class is used to declare variables that retain their values throughout the program execution.
Variables declared with static storage class have a lifetime that extends for the entire duration of the program.
They are initialized only onc...read more

Asked in Brigosha Technologies

Q. Implement bit fields and explain with a piece of code.
Bit fields are used to allocate specific number of bits in a structure to store and manipulate data efficiently.
Bit fields are declared using a colon (:) followed by the number of bits to allocate.
They can be used to represent flags, status bits, or ...read more

Asked in Johnson Controls

Q. How many classes are there in C? Explain.
There are no classes in C as it is a procedural programming language.
C is a procedural programming language, not an object-oriented one.
It does not have the concept of classes or objects.
Instead, it uses functions and structures to organize code.
Stru...read more
C Jobs




Asked in Cognizant

Q. Can you write code in C language?
Here is a simple example of a C program that prints 'Hello, World!'
Declare a main function
Use the printf function to print 'Hello, World!'
Return 0 to indicate successful execution

Asked in DXC Technology and 5 others

Q. Write a simple C program.
A simple C program
Include the stdio.h header file
Declare the main function
Use printf() function to print output
Use scanf() function to take input
End the program with return 0;

Asked in Altisource

Q. How can you find common elements from two arrays using C?
Finding common elements in two arrays of strings using C
Create two arrays of strings
Loop through each element of the first array
For each element, loop through the second array to check for a match
If a match is found, add it to a third array
Return the...read more

Asked in Aptiv

Q. What are storage class specifiers in C?
Storage class specifiers in C are used to define the scope and lifetime of variables.
There are four storage class specifiers in C: auto, register, static, and extern.
Auto variables are local to a block and have automatic storage duration.
Register var...read more
Asked in Imaginnovate

Q. Are any libraries required to perform C programming, and if so, what are they?
Yes, some libraries are required for C programming such as stdio.h, math.h, string.h, etc.
stdio.h library is used for input/output operations
math.h library is used for mathematical operations
string.h library is used for string manipulation operations

Asked in OpenText Technologies

Q. Write a program to implement strcmp.
Program to implement strcmp
Use a loop to compare each character of the two strings
Return 0 if both strings are equal, -1 if s1
s2 Handle null and empty strings appropriately

Asked in Microsoft Corporation

Q. What is the use of the printf() and scanf() functions?
printf() is used to print formatted output to the screen, while scanf() is used to read formatted input from the user.
printf() is used to display output on the screen in a formatted way.
scanf() is used to read input from the user in a formatted way.
E...read more

Asked in Gibraltar Technologies

Q. Which of the following is not a storage class in C? a) auto b) extern c) static d) dynamic
In C, 'dynamic' is not a storage class; valid ones include auto, extern, and static.
Storage classes define the scope, visibility, and lifetime of variables.
auto: Default storage class for local variables, e.g., 'int x;' inside a function.
extern: Used...read more

Asked in Adobe

Q. What are the four storage classes in C?
The four storage classes in C are auto, register, static, and extern.
Auto: default storage class for all local variables
Register: used to define local variables that should be stored in a register instead of RAM
Static: used to define local variables ...read more

Asked in Gibraltar Technologies

Q. What does 'int x:4;' mean? a) x is a four-digit number. b) x is a four-bit integer. c) x cannot be greater than 4 digits. d) None of these.
b) x is four bit integer.
The statement 'int x:4;' indicates that x is a four bit integer.
A four bit integer can have values ranging from 0 to 15.
The colon followed by the number 4 specifies the number of bits allocated for x.

Asked in CSG International

Q. Write a C program and explain each line.
A C program that needs to be written and explained line by line.
The program should be written in C language.
Each line of the program needs to be explained.
The program should use an array of strings.
The answer should be returned in JSON format.
Asked in Imaginnovate

Q. How can we start a program in the C language?
To start a program in C language, we need to write a main function and compile the code.
Write the main function with the code to be executed
Compile the code using a C compiler
Execute the compiled program
Optionally, pass command line arguments to the ...read more

Asked in Tejas Networks

Q. Write the Test_and_Set program
Test_and_Set program is used to ensure mutual exclusion in concurrent systems.
Test_and_Set is a hardware instruction that sets a memory location to a value and returns its old value.
The program uses a loop to repeatedly execute the Test_and_Set instr...read more

Asked in embedUR Systems

Q. Define structure and union in C.
Structure and union are two user-defined data types in C used to store multiple data types under a single variable name.
Structure is a collection of variables of different data types under a single name.
Union is similar to structure but all the varia...read more

Asked in Automatic Data Processing (ADP)

Q. What is the difference between delete and free?
Delete and free are both used to deallocate memory, but delete is used for objects created with new, while free is used for memory allocated with malloc.
delete is used in C++ to deallocate memory for objects created with new keyword
free is used in C ...read more

Asked in Qualcomm

Q. What do static, volatile, and const mean in C?
Static, volatile, const are C keywords used to define properties of variables.
Static: used to define a variable that retains its value between function calls
Volatile: used to indicate that a variable's value may change unexpectedly, e.g. in an interr...read more

Asked in TCS

Q. Why is the main function required in a C program?
Main function is required in C program as it is the entry point of the program.
Main function is where the program starts executing.
It contains the code that initializes variables, calls functions, and performs other necessary tasks.
Without main funct...read more

Asked in Oberoi Group of Hotels

Q. What is the difference between ARR and ADR?
Arr and adr are both used in programming, but arr typically refers to an array while adr typically refers to an address.
Arr is commonly used to refer to an array in programming, which is a collection of elements stored in a contiguous memory location...read more

Asked in Capgemini Engineering

Q. Explain the entire process of converting an Example.c file to Example.exe.
The process of converting Example.c file to Example.exe involves several steps.
Preprocessing: includes header file inclusion, macro expansion, and conditional compilation
Compilation: converts source code to object code
Linking: combines object code wi...read more

Asked in Microsoft Corporation

Q. Who is the founder of the C language?
The founder of C language is Dennis Ritchie.
Dennis Ritchie is the creator of the C programming language.
He developed C language at Bell Labs in the early 1970s.
C language is widely used for system programming and developing other programming language...read more
Top Interview Questions for Related Skills
Interview Experiences of Popular Companies










Interview Questions of C Related Designations



Reviews
Interviews
Salaries
Users

