ADTs and Black Boxes Functions in C

This C Tutorial Explains ADTs and Black Boxes in Context with Functions in C. Many programmers like to think of a function as a “black box” defined in terms of the information that goes in (its input) and the value or action it produces (its output). What goes on inside the black box is not … Read more

advertisement

Efficiency of Recursion vs Iteration in C

Question: Which is more Efficient in C Programming – Recursion OR Iteration? Answer: In general, recursion is slow, exhausting computer’s memory resources while iteration performs on the same variables and so is efficient. But recursion on the other hand, in some situations, offers convenient tool than iterations. Let’s take an example of a program below … Read more

advertisement

Difference Between Recursion and Iteration in C

Question: Is Recursion in C Different from Iteration Implemented Through Loops Answer: To understand the difference between Recursion and Iteration implemented through loops, let’s first consider a simple program, /* down_recur.c — program counts down ways */ #include <stdio.h> void countdown(int);   int main(void) { int num = 100; countdown(num);   return 0; }   … Read more

advertisement

Explain Recursion with Example in C

This C Tutorial Explains the concept Recursion in C Programming with examples. C allows a function to call itself. This is called Recursion. Let’s see an example, void main(void) { main(); } What happens when the program is compiled and run, main() function’s type, here for ex., is void and it doesn’t take any arguments. … Read more

advertisement

Functions in C with Examples

This Tutorial Explains Functions in C with Example(s). What is Function in C? A function is a block of code that performs a specific task. Functions are often used to perform similar tasks on different data sets. There are two types of functions in C, user-defined functions and library functions. User-defined functions are the functions … Read more

advertisement

Which Function Comes as an Integral Component of C Program?

Question: Is Function an Integral Component of Every C Program? Answer: Before we proceed to answer this, let’s look at the design, in its simplest form, of a C program, /* * sim_c_prog.c — program shows even simplest C program requires function * main() */ void main(void) { /* Nothing happens here! */ } When … Read more

advertisement

Escape Sequences in C

This C Tutorial explains Escape Sequences/Character Escapes and why they are needed. What is an Escape Sequences in C? One or more characters following ‘\’ (the backslash) is considered to be a single character and is called the escape sequence. List of Escape Sequences in C: \? used to write multiple question marks from being … Read more

advertisement

Can the Parameters of a Function in C be Declared Static?

Question: Can the Formal Parameters to a Function in C be declared Static? Answer: Let’s first try a static variable to see how it behaves when function containing the variable is called more than once. For example, /* * behaviour_static_var_fun.c — program shows how static variable * behaves */ #include <stdio.h> void display_static_var(void); /* declaration … Read more

advertisement

Expressions in C

This C Tutorial Explains C Expressions. What is Expression in C? Expression in C is a combination of operators and operands that specify an operation to perform. The value of the expression is the result of the operation. Example: 50; /* an integer constant */ 543.0009; /* a real constant */ x + y; /* … Read more

advertisement

Difference between Macros and Constants in C

This C Tutorial explains the difference between Macro and Const Declaration. Lets start with: what is/are the difference/s between the following two statements and which of these two is efficient and meaningful? #define SIZE 50 int const size = 50; Answer: MACROS 1. The statement “#define SIZE 50” is a preprocessor directive with SIZE defined … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.