Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Data Structures Algorithms Interview Preparation Topic-wise Practice C++ Java

×
Python

Sign In Sign Up
C Programming Language
Last Updated : 24 Nov, 2021

account_circle Username or email

lock Password


Remember me
Forgot Password

Sign In

or

 Google  Facebook

 LinkedIn  GitHub
Why Create an Account?
C is a procedural programming language. It was initially developed by Dennis Ritchie as a system pro-

Byoperating
gramming language to write creating this account,
system.you agree
The tomain
our Privacy Policy & Cookie
features of CPolicy.
language include low-level ac-

cess to memor y, simple set of keywords, and clean style, these features make C language suitable for

system programming like operating system or compiler development.

Recent Articles on C !

We use cookies to ensure you have the best browsing experience on our website. By using
C Output & Multiple Choice Questions

our site, you


acknowledge that you have read and understood our
Cookie Policy &
Privacy Got It !
Policy
Basics, Variable Declaration, Definition and Scope, Data Types, Storage Classes, Input/Output,

Operators, Preprocessor, Array & Strings, Control Statements, Functions, Pointers, Enum, Struct and

Start Your Coding Journey Now! Login


Union, Memor y Management, File Handling, Puzzles, Misc, C Language Inter view Questions, Multiple
Register×
Choice Questions

Sign In Sign Up

1. PROGRAMMING FOR BEGINNERS ❯


OUR BEST ❯
account_circle Username or email 2. LEARN PYTHON PROGRAMMING

AVAILABLE Ad |
360 Topics

FARES
lock Password TO THE
U.S.
Remember me
Forgot Password
Book now
Sign In

or

 Google
Basics:
 Facebook
Functions:

1. C L anguage Introduction 1. Functions in C

 LinkedIn
2. C Programming L anguage Standard
 GitHub
2. Impor tance of function prototype in C

3. int (1 sign bit + 31 data bits) keyword in C 3. Functions that are executed before and after
Why Create an Account?
4. Is it fine to write “void main()” or “main()” in main() in C

By creating this account, you agree to our Privacy Policy & Cookie Policy.
C/C++? 4. return statement vs exit() in main()

5. Difference between “int main()” and “int 5. How to Count Variable Numbers of

main(void)” in C/C++? Arguments in C?,

6. Macros and Preprocessors in C 6. What is evaluation order of function param-

7. Compiling a C program:- Behind the Scenes eters in C?

8. Benefits of C over other languages 7. Does C suppor t function overloading?

9. Program error signals 8. How can we return multiple values from a

10. Escape sequences in C function?

11. Line Slicing in C 9. What is the purpose of a function prototype?

12. C/ C++ Tokens 10. Static functions in C

11. exit(), abor t() and asser t()

Variable Declaration, Definition and Scope: 12. Implicit return type int in C

13. What happens when a function is called be-


1. Variables and Keywords in C

We use cookies to ensure you have the best browsing experience on our website.
fore By using
its declaration in C?
2. How are variables scoped in C – Static or
our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Got It !
14. _Noreturn function specifier in C
Dynamic? Policy
3. Scope rules in C 15. exit() vs _Exit()

4. How Linkers Resolve Multiply Defined 16. __func__ identifier in C

Start Your Coding Journey Now!


Global Symbols? Login
17. Callback function in C Register×
5. Quiz on Variable Declaration and Scope 18. Nested functions in C

6. Complicated declarations in C 19. Parameter Passing Techniques

Sign In Sign Up
7. Redeclaration of global variable in C 20. pow() function in C

8. Internal and External Linkage 21. tolower() function in C

9. Declare variable as constant 22. time() function in C

account_circle Username or email


10. Why variables doesn’t star t with numbers

11. Redeclaration of global variables Pointers:

lock Password
12. Initialization of global and static variables
1. Introduction to pointers in C and C++

2. Double Pointer (Pointer to Pointer) in C


Remember
Data me
Types:
Forgot Password
3. Why C treats array parameters as pointers?

1. Data Types in C 4. Output of the program | Dereference,

Sign In
2. Use of bool in C Reference, Dereference, Reference

3. Integer Promotions in C
or 5. Dangling, Void , Null and Wild Pointers

4. Quiz on Data Types in C 6. An Uncommon representation of array

 Google
5. Comparison of a float with a value in C

elements Facebook
6. Need of long data type in C 7. How to declare a pointer to a function?

7. size_t data type in C 8. Pointer vs Array in C

 LinkedIn
8. Interesting facts about data-types and

9. void pointer in C
GitHub
Why Create an10.
Account?
modifiers NULL pointer in C !

9. Float and Double in C By creating this account, you agree to our


11.Privacy Policy & Cookie
Function Policy.in
Pointer C

10. Character arithmetic in C 12. near, far and huge pointers

11. Typecasting in C 13. Generic Linked List in C

14. restrict keyword in C

Storage Classes: 15. const char *p, char * const p and const char

* const p
1. Storage Classes in C

16. Pointer to an Array


2. Static Variables in C

3. Understanding “extern” keyword in C

Enum, Struct and Union:


4. What are the default values of static vari-

ables in C? 1. Enum in C

5. Understanding “volatile” qualifier in C 2. Structures in C

6. Const Qualifier in C 3. Union in C

7. Initialization of static variables in C 4. Struct Hack

We
8. use cookies to ensure“register
Understanding you have the best browsing
” keyword in C experience on
5.our website. By
Structure using
Member Alignment, Padding and

our site, you


acknowledge that you have read and understood our
Cookie Policy &
Privacy Got It !
9. Quiz on Storage Classes in C Data Packing
Policy
10. Understanding volatile qualifier in C- Set 1 6. Operations on struct variables in C

7. Bit Fields in C

Start Your Coding Journey Now!Input/Output: Login Register×


8. Structure Sor ting (By Multiple Rules) in C++

9. Flexible array members in structure


1. Returned values of printf() and scanf()

10. Difference between Structure and Union

Sign In
2. What is return type of getchar(), fgetc() and Sign Up
11. Difference between C structures and C++
getc() ?

structures
3. Scansets in C

12. Anonymous Union and Structure in C

account_circle
4. puts() vs printf() for printing a string
Username or email 13. Compound Literals in C
5. What is use of %n in printf() ?

6. How to print % using printf()?

lock
7. Quiz on Input Output in C
Password Memory Management:

8. Difference between printf, sprintf and 1. Memor y L ayout of C Programs,


Remember me
fprintf? Forgot Password
2. How to deallocate memor y without using

9. Difference between getc(), getchar(), free() in C?

Sign In
getch() and getche() 3. calloc() versus malloc()

10. Difference between %d and %i format


or 4. How does free() know the size of memor y to

specifier be deallocated?


11. Use of fflush(stdin) in C Google 
5. Use of realloc() Facebook
12. Clearing input buffer in C/C++ 6. What is Memor y Leak? How can we avoid?

13. scanf() and fscanf() in C


14. getchar_unlocked() in C
LinkedIn  GitHub
File Handling:

15. Problem with scanf()


Why Create an Account?
1. fseek() vs rewind() in C

16. Differentiate printableByand


creating this account,
control you agree to
character our Privacy Policy & Cookie Policy.
2. EOF, getc() and feof() in C

17. rand() and srand() in C/C++


3. fopen() for an existing file in write mode

4. Read/ Write structure to a file

Operators:
5. fgets() and gets() in C

1. Introduction to operators in C and Arithmetic 6. Basics of File Handling

Operators 7. fsetpos() in C

2. Relational and Logical Operators in C 8. rename function in C/C++

3. Bitwise Operators in C 9. tmpfile() function in C

4. Operator Precedence and A ssociativity in C 10. fgetc() and fputc() in C

5. Evaluation order of operands 11. fseek() in C/C++

6. Comma in C and C++ 12. ftell() in C

7. sizeof operator in C 13. lseek() in C/C++

8. Operands for sizeof operator 14. remove function in C/C++

We
9. use cookies to
A comma ensure youquestion
operator have the best browsing experience15.
on our website.
Merge By using of two files into a third file
contents

our site, you


acknowledge that you have read and understood our
Cookie Policy &
Privacy Got It !
16. Print contents of file in C
Policy
10. Result of comma operator as l-value in C Puzzles:

and C++

Start Your Coding Journey Now!


11. Order of operands for logical operators Login
1. C Program to print numbers from 1 to N

without using semicolon?


Register×
12. Increment (Decrement) operators require L-
2. How to find sum of two numbers without us-

value Expression

Sign In ing any operatorSign Up


13. Precedence of postfix ++ and prefix ++ in
3. How will you show memor y representation

C/C++
of C variables?

14. Modulus on Negative Numbers

account_circle
4. Condition To Print “HelloWord”
Username or email
15. C/C++ Ternar y Operator – Some Interesting
5. Change/add only one character and print ‘*’

Obser vations

exactly 20 times

lock Password
16. Pre-increment (or pre-decrement) in C++

17. Difference between ++*p, *p++ and *++p


6. How can we sum the digits of a given num-

ber in single statement?


Remember me
18. Results of comparison operations in C and
Forgot Password
7. What is the best way in C to conver t a num-

C++

ber to a string?

19. To find sum of two numbers without using Sign In


8. Calculate Logn in one line

any operator

or 9. Print “Even” or “Odd” without using

20. Sequence Points in C


Conditional statement

21. Execution of printf with ++ operators

 Google
22. Anything written in sizeof() is never
 Facebook
10. How will you print numbers from 1 to 100

without using loop?

executed

 
11. How can we sum the digits of a given num-
LinkedIn
23. Difference between strlen() and sizeof() GitHub
ber in single statement?

24. Stringizing and Token-pasting operator Why Create an Account?


12. How will you print “Geeks for Geeks” with-

By creating this account, you agree to our Privacy


out Policy
using & Cookie Policy.
a semicolon

Preprocessor:
13. Write a one line C function to round floating

1. Write a C macro PRINT(x) which prints x point numbers

2. Variable length arguments for Macros 14. How will implement Your Own sizeof

3. Multiline macros in C 15. How to count set bits in a floating point

4. CR A SH() macro – interpretation number in C?

5. The OFFSE TOF() macro, 16. How to change the output of printf() in

6. Branch prediction macros in GCC main() ?

7. Diffference between #define and const in C? 17. How to find length of a string without

8. A C Programming L anguage Puzzle string.h and loop in C?

9. What’s difference between header files 18. Implement your own itoa()

“stdio.h” and “stdlib.h” ? 19. Write a C program that does not terminate

10. How to print a variable name in C? when Ctrl+C is pressed

11. Constants in C 20. How to measure time taken by a function in


We use cookies to ensure you have the best browsing experience on our website. By using
12. How a Preprocessor works
our site, you
acknowledge that you have read and understood our
Cookie
C? Policy &
Privacy Got It !
Policy 21. Print a long int in C using putchar() only
13. Preprocessor Directives : Behind the scene- 22. Conver t a floating point number to string in

1 C

Start Your Coding Journey Now!


14. Preprocessor Directives : Behind the scene- Login
23. How to write a running C code without Register×
2 main()?

15. isgraph() librar y function 24. Write your own memcpy()

Sign In Sign Up
16. write your own header file in C 25. C program to print characters without using

17. difftime() librar y function format specifiers

18. tmpnam() librar y function 26. C program to print a string without any

account_circle
19. _Generic keyword in C Username or email quote (singe or double) in the program

20. math.h librar y functions 27. Execute both if and else statements

lock
21. typedef versus #define in C
Password simultaneously

22. str ftime() librar y function 28. Print “Hello World” without using any header


Remember me
23. exec family of functions file
Forgot Password

Arrays & Strings: Sign In Misc:

1. Introduction to Arrays in C L anguage


or 1. Quine – A self-reproducing program

2. Strings in C L anguage 2. Complicated declarations in C


3. Proper ties of array in C L anguage Google 
3. Use of bool in C Facebook
4. Do not use sizeof for array parameters 4. Sequence Points in C | Set 1

5. Initialization of variables sized arrays in C 5. Optimization Techniques | Set 2


6. Are array members deeply copied?
LinkedIn 
(swapping),
GitHub
Why Create an Account?
7. What is the difference between single 6. A SCII NUL, A SCII 0 (’0?) and Numeric literal

By creating
quoted and double quoted this account, you
declaration ofagree to our Privacy
0 Policy & Cookie Policy.

char array? 7. Little and Big Endian Myster y,

8. Initialization of a multidimensional arrays in 8. Comparator function of qsor t() in C

C/C++ 9. Program to validate an IP address

9. Write one line functions for strcat() and 10. Multithreading in C

strcmp() 11. A sser tions in C/C++

10. What’s difference between char s[] and char 12. fork() in C

*s in C 13. Interesting Facts in C Programming

11. gets() is risk y to use! 14. Precision of floating point numbers in C++

12. C function to Swap strings, (floor(), ceil(), trunc(), round() and

13. Storage for Strings in C setprecision())

14. Difference between array and pointer 15. setjump() and longjump() in C

15. How to dynamically allocate a 2D array in C? 16. nextafter() and nexttoward() in C/C++

16. How to pass a 2D array as a parameter in C? 17. pthread_cancel() in C


We use cookies to ensure you have the best browsing experience on our website. By using
17. How to write long strings in Multi-lines 18. pthread_equal() in C
our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Got It !
C/C++? Policy 19. pthread_self() in C
18. What are the data types for which it is not 20. Local L abels in C

possible to create an array? 21. lvalue and r value in C

Start Your Coding Journey Now!


19. Variable Length Arrays in C and C++ Login Register×
22. Get and set the stack size of thread attribute

20. Shor t hand array notation 23. Difference between fork() and exec()

21. Accessing array out of bounds 24. Errors in C/C++

Sign In Sign Up
22. strcpy() in C/C++ 25. Why is C considered faster than other

23. strcmp() in C/C++ languages

24. strdup() and strdndup() in C/C++ 26. Incompatibilities between C and C++

account_circle
25. Pass an array by value Username or email 27. Conver t C/C++ code to assembly language

26. Reverse a string in C/C++ 28. Error Handling in C

lock
27. strpbrk() in C

28. strcoll() in C/C++


Password 29. Executing main() in C/C++ : Behind the

scene


Remember me
29. ispunct() in C 30. Hygienic Macros in C
Forgot Password
30. strspn() in C 31. Command line arguments in C/C++

31. isalpha() and isdigit() in C/C++ Sign 32.


In scanf(), fscanf(), sscanf(), scanf_s(),
fscanf_s(), sscanf_s()

or
Control Statements: 33. Some Interesting Facts in C Programming

34. Database Connectivity using C/C++

 Google
1. What should be data type of case labels of
 Facebook
35. Function Interposition in C
switch statement in C?

36. Macros vs Functions


2. For Versus While


3. A nested loop puzzle
LinkedIn  GitHub
37. Write your own memcpy() and memmove()

4. switch statement in C
Why Create an Account?
C Language Interview Questions
By creating this
5. Difference between while(1) and account, you agree
while(0) to our Privacy Policy & Cookie Policy.

6. goto statement Commonly A sked C Programming Inter view

7. Continue Statement Questions | Set 1

8. Break Statement Commonly A sked C Programming Inter view

9. Using range in switch case Questions | Set 2

C/C++ Programs

Coding Practice Platform

Geeksforgeeks Courses:

1. Language Foundation Courses [C++ / JAVA / Python ]

Learn any programming language from scratch and understand all its fundamentals concepts for a

We use cookies to ensure you have the best browsing experience on our website. By using
strong programming foundation in the easiest possible manner with help of GeeksforGeeks
our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Got It !
Policy
Language Foundation Courses – Java Foundation | Python Foundation | C++ Foundation
2. Geeks Classes Live

Get inter view-centric live online classes on Data Structure and Algorithms from any geographical lo-

Start Your Coding Journey Now!


cation to learn and master DSA concepts for enhancing your problem-solving & programming skills
Login Register×
and to crack the inter view of any product-based company – Geeks Classes: Live Session

3. Complete Interview Preparation

Sign In Sign Up
Get fulfilled all your inter view preparation needs at a single place with the Complete Inter view

Preparation Course that provides you all the required stuff to prepare for any product-based, ser vice-

account_circle Username or email


based, or start-up company at the most affordable prices.

4. DSA Self Paced

lock Password
Start learning Data Structures and Algorithms to prepare for the inter views of top IT giants like


Remember me
Microsoft, Amazon, Adobe, etc. with DSA Self-Paced Course where you will get to learn and master

Forgot Password
DSA from basic to advanced level and that too at your own pace and convenience.

Sign In
5. Company Specific Courses – Amazon, Microsoft, TCS & Wipro

Crack the inter view of any product-based giant company by specifically preparing with the questions
or
that these companies usually ask in their coding inter view round. Refer GeeksforGeeks Company

 Google
Specific Courses: Amazon SDE Test Series, etc.
 Facebook

 LinkedIn  GitHub
Why Create an Account?

By creating this account, you agree to our Privacy Policy & Cookie Policy.

We use cookies to ensure you have the best browsing experience on our website. By using
our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Got It !
Policy
Start Your Coding Journey Now! Login Register×

Sign In Sign Up
Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.

Load Comments
account_circle Username or email

lock Password 5th Floor, A-118,

Sector-136, Noida, Uttar Pradesh - 201305



Remember me
feedback@geeksforgeeks.org Forgot Password

Sign In

or

 Google
Company  Facebook
Learn
About Us Algorithms
 Careers
LinkedIn  GitHub
Data Structures
Why Create an Account?
Privacy Policy Languages
By creating this account, you agree to our Privacy Policy & Cookie Policy.
Contact Us CS Subjects
Copyright Policy Video Tutorials

Web Development Contribute


Web Tutorials Write an Article
HTML Write Interview Experience
CSS Internships
JavaScript Videos
Bootstrap

@geeksforgeeks
, Some rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using
our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Got It !
Policy

You might also like