Search...
22
Commonly Asked C Programming Interview
Questions | Set 2
Last Updated : 23 Jul, 2025
This post is second set of Commonly Asked C Programming Interview
Questions | Set 1
What are main characteristics of C language?
C is a procedural language. The main features of C language include
low-level access to memory, simple set of keywords, and clean style.
These features make it suitable for system programming like operating
system or compiler development.
What is difference between i++ and ++i?
1) The expression 'i++' returns the old value and then increments i. The
expression ++i increments the value and returns new value.
C 2) Precedence
C Basics of postfix
C Data Types ++ is higher
C Operators than
C Input and that of
Output prefixFlow
C Control ++. C Functions
3) Associativity of postfix ++ is left to right and associativity of prefix ++
is right to left.
4) In C++, ++i can be used as l-value, but i++ cannot be. In C, they both
cannot be used as l-value.
See Difference between ++*p, *p++ and *++p for more details.
What is l-value?
l-value or location value refers to an expression that can be used on left
side of assignment operator. For example in expression "a = 3", a is l-
value and 3 is r-value.
l-values are of two types:
"nonmodifiable l-value" represent a l-value that can not be modified.
const variables are "nonmodifiable l-value".
"modifiable l-value" represent a l-value that can be modified.
Refer lvalue and rvalue in C language for details.
What is the difference between array and pointer?
See Array vs Pointer
How to write your own sizeof operator?
#define my_sizeof(type) (char *)(&type+1)-(char*)(&type)
See Implement your own sizeof for more details.
How will you print numbers from 1 to 100 without using loop?
We can use recursion for this purpose.
/* Prints numbers from 1 to n */
void printNos(unsigned int n)
{
if(n > 0)
{
printNos(n-1);
printf("%d ", n);
}
}
What is volatile keyword?
The volatile keyword is intended to prevent the compiler from applying
any optimizations on objects that can change in ways that cannot be
determined by the compiler.
Objects declared as volatile are omitted from optimization because their
values can be changed by code outside the scope of current code at any
time. See Understanding “volatile” qualifier in C for more details.
Can a variable be both const and volatile?
yes, the const means that the variable cannot be assigned a new value.
The value can be changed by other code or pointer. For example the
following program works fine.
#include <stdio.h>
int main(void)
{
const volatile int local = 10;
int* ptr = (int*)&local;
printf("Initial value of local : %d \n", local);
*ptr = 100;
printf("Modified value of local: %d \n", local);
return 0;
}
Practices Quizzes on C
C articles
We will soon be publishing more sets of commonly asked C
programming questions.
Comment More info
Campus Training Program
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate
Tower, Sector- 136, Noida, Uttar Pradesh
(201305)
Registered Address:
K 061, Tower K, Gulshan Vivante
Apartment, Sector 137, Noida, Gautam
Buddh Nagar, Uttar Pradesh, 201305
Advertise with us
Company Explore
About Us POTD
Legal Job-A-Thon
Privacy Policy Connect
Careers Community
Contact Us Videos
Corporate Solution Blogs
Campus Training Program Nation Skill Up
Tutorials Courses
Programming Languages IBM Certification
DSA DSA and Placements
Web Technology Web Development
AI, ML & Data Science Data Science
DevOps Programming Languages
CS Core Subjects DevOps & Cloud
Interview Preparation GATE
GATE Trending Technologies
School Subjects
Software and Tools
Offline Centers Preparation Corner
Noida Aptitude
Bengaluru Puzzles
Pune GfG 160
Hyderabad DSA 360
Patna System Design
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved