C Programming

C is a procedural programming language. It was initially developed by Dennis Ritchie as a system programming language to write an operating system. The main features of C language include low-level access to memory, simple set of keywords, and a clean style, these features make C language suitable for system programming like operating system or compiler development.

Basics:

Variable Declaration, Definition and Scope:

Data Types:

Storage Classes:

Input/Output:

Operators:

Preprocessor:

  • Write a C macro PRINT(x) which prints x
  • Variable length arguments for Macros
  • Multiline macros in C
  • CRASH() macro – interpretation
  • The OFFSETOF() macro,
  • Branch prediction macros in GCC
  • Diffference between #define and const in C?
  • A C Programming Language Puzzle
  • What’s difference between header files “stdio.h” and “stdlib.h” ?
  • How to print a variable name in C?
  • Constants in C
  • How a Preprocessor works
  • Preprocessor Directives : Behind the scene-1
  • Preprocessor Directives : Behind the scene-2
  • isgraph() library function
  • write your own header file in C
  • difftime() library function
  • tmpnam() library function
  • _Generic keyword in C
  • math.h library functions
  • typedef versus #define in C
  • strftime() library function
  • exec family of functions

Arrays & Strings:

  • Introduction to Arrays in C Language
  • Strings in C Language
  • Properties of array in C Language
  • Do not use sizeof for array parameters
  • Initialization of variables sized arrays in C
  • Are array members deeply copied?
  • What is the difference between single quoted and double quoted declaration of char array?
  • Initialization of a multidimensional arrays in C/C++
  • Write one line functions for strcat() and strcmp()
  • What’s difference between char s[] and char *s in C
  • gets() is risky to use!
  • C function to Swap strings,
  • Storage for Strings in C
  • Difference between array and pointer
  • How to dynamically allocate a 2D array in C?
  • How to pass a 2D array as a parameter in C?
  • How to write long strings in Multi-lines C/C++?
  • What are the data types for which it is not possible to create an array?
  • Variable Length Arrays in C and C++
  • Short hand array notation
  • Accessing array out of bounds
  • strcpy() in C/C++
  • strcmp() in C/C++
  • strdup() and strdndup() in C/C++
  • Pass an array by value
  • Reverse a string in C/C++
  • strpbrk() in C
  • strcoll() in C/C++
  • ispunct() in C
  • strspn() in C
  • isalpha() and isdigit() in C/C++

Control Statements:

  • What should be data type of case labels of switch statement in C?
  • For Versus While
  • A nested loop puzzle
  • switch statement in C
  • Difference between while(1) and while(0)
  • goto statement
  • Continue Statement
  • Break Statement
  • Using range in switch case

Functions:

  • Functions in C
  • Importance of function prototype in C
  • Functions that are executed before and after main() in C
  • return statement vs exit() in main()
  • How to Count Variable Numbers of Arguments in C?,
  • What is evaluation order of function parameters in C?
  • Does C support function overloading?
  • How can we return multiple values from a function?
  • What is the purpose of a function prototype?
  • Static functions in C
  • exit(), abort() and assert()
  • Implicit return type int in C
  • What happens when a function is called before its declaration in C?
  • _Noreturn function specifier in C
  • exit() vs _Exit()
  • __func__ identifier in C
  • Callback function in C
  • Nested functions in C
  • Parameter Passing Techniques
  • pow() function in C
  • tolower() function in C
  • time() function in C

Pointers:

  • Introduction to pointers in C and C++
  • Double Pointer (Pointer to Pointer) in C
  • Why C treats array parameters as pointers?
  • Output of the program | Dereference, Reference, Dereference, Reference
  • Dangling, Void , Null and Wild Pointers
  • An Uncommon representation of array elements
  • How to declare a pointer to a function?
  • Pointer vs Array in C
  • void pointer in C
  • NULL pointer in C !
  • Function Pointer in C
  • near, far and huge pointers
  • Generic Linked List in C
  • restrict keyword in C
  • const char *p, char * const p and const char * const p
  • Pointer to an Array
  • Callback function in C

Enum, Struct and Union:

  • Enum in C
  • Structures in C
  • Union in C
  • Struct Hack
  • Structure Member Alignment, Padding and Data Packing
  • Operations on struct variables in C
  • Bit Fields in C
  • Structure Sorting (By Multiple Rules) in C++
  • Flexible array members in structure
  • Difference between Structure and Union
  • Difference between C structures and C++ structures
  • Anonymous Union and Structure in C
  • Compound Literals in C

Memory Management:

  • Memory Layout of C Programs,
  • How to deallocate memory without using free() in C?
  • calloc() versus malloc()
  • How does free() know the size of memory to be deallocated?
  • Use of realloc()
  • What is Memory Leak? How can we avoid?

File Handling:

  • fseek() vs rewind() in C
  • EOF, getc() and feof() in C
  • fopen() for an existing file in write mode
  • Read/Write structure to a file
  • fgets() and gets() in C
  • Basics of File Handling
  • fsetpos() in C
  • rename function in C/C++
  • tmpfile() function in C
  • fgetc() and fputc() in C
  • fseek() in C/C++
  • ftell() in C
  • lseek() in C/C++
  • remove function in C/C++
  • Merge contents of two files into a third file
  • Print contents of file in C

Puzzles:

  • C Program to print numbers from 1 to N without using semicolon?
  • How to find sum of two numbers without using any operator
  • How will you show memory representation of C variables?
  • Condition To Print “HelloWord”
  • Change/add only one character and print ‘*’ exactly 20 times
  • How can we sum the digits of a given number in single statement?
  • What is the best way in C to convert a number to a string?
  • Calculate Logn in one line
  • Print “Even” or “Odd” without using Conditional statement
  • How will you print numbers from 1 to 100 without using loop?
  • How can we sum the digits of a given number in single statement?
  • How will you print “Geeks for Geeks” without using a semicolon
  • Write a one line C function to round floating point numbers
  • How will implement Your Own sizeof
  • How to count set bits in a floating point number in C?
  • How to change the output of printf() in main() ?
  • How to find length of a string without string.h and loop in C?
  • Implement your own itoa()
  • Write a C program that does not terminate when Ctrl+C is pressed
  • How to measure time taken by a function in C?
  • Print a long int in C using putchar() only
  • Convert a floating point number to string in C
  • How to write a running C code without main()?
  • Write your own memcpy()
  • C program to print characters without using format specifiers
  • C program to print a string without any quote (singe or double) in the program
  • Execute both if and else statements simultaneously
  • Print “Hello World” without using any header file

Misc:

  • Quine – A self-reproducing program
  • Complicated declarations in C
  • Use of bool in C
  • Sequence Points in C | Set 1
  • Optimization Techniques | Set 2 (swapping),
  • ASCII NUL, ASCII 0 (’0?) and Numeric literal 0
  • Little and Big Endian Mystery,
  • Comparator function of qsort() in C
  • Program to validate an IP address
  • Multithreading in C
  • Assertions in C/C++
  • fork() in C
  • Interesting Facts in C Programming
  • Precision of floating point numbers in C++ (floor(), ceil(), trunc(), round() and setprecision())
  • setjump() and longjump() in C
  • nextafter() and nexttoward() in C/C++
  • pthread_cancel() in C
  • pthread_equal() in C
  • pthread_self() in C
  • Local Labels in C
  • lvalue and rvalue in C
  • Get and set the stack size of thread attribute
  • Difference between fork() and exec()
  • Errors in C/C++
  • Why is C considered faster than other languages
  • Incompatibilities between C and C++
  • Convert C/C++ code to assembly language
  • Error Handling in C
  • Executing main() in C/C++ : Behind the scene
  • Hygienic Macros in C
  • Command line arguments in C/C++
  • scanf(), fscanf(), sscanf(), scanf_s(), fscanf_s(), sscanf_s()
  • Some Interesting Facts in C Programming
  • Database Connectivity using C/C++
  • Function Interposition in C
  • Macros vs Functions
  • Write your own memcpy() and memmove()

Previous Post Next Post