Posts

Recursion in C

C - Recursion Advertisements Previous Page Next Page Recursion is the process of repeating items in a self-similar way. In programming languages, if a program allows you to call a function inside the same function, then it is called a recursive call of the function. void recursion() { recursion(); /* function calls itself */ } int main() { recursion(); } The C programming language supports recursion, i.e., a function to call itself. But while using recursion, programmers need to be careful to define an exit condition from the function, otherwise it will go into an infinite loop. Recursive functions are very useful to solve many mathematical problems, such as calculating the factorial of a number, generating Fibonacci series, etc. Number Factorial The following example calculates the factorial of a given number using a recursive function − Live Demo #include unsigned long long int factorial(unsigned int i) { if(i int fibonacci(int i) { if(i == 0) { ret...

C Arrays....?

C - Arrays Advertisements Previous Page Next Page Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type. Instead of declaring individual variables, such as number0, number1, ..., and number99, you declare one array variable such as numbers and use numbers[0], numbers[1], and ..., numbers[99] to represent individual variables. A specific element in an array is accessed by an index. All arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element. Arrays in C Declaring Arrays To declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows − type arrayName [ arraySize ]; This is called a single-dimensional array. The arraySize must be...

Loops in C...?

Skip to content Courses Tutorials Jobs Practice Write Write Come write articles for us and get featured Practice Practice Learn and code with the best industry experts Premium Premium Get access to ad-free content, doubt assistance and more! Jobs Jobs Come and find your dream job with us Geeks Digest Quizzes Geeks Campus Gblog Articles IDE Campus Mantri Sign In Sign In Home Saved Videos Courses For Working Professionals LIVE Self-Paced For Students LIVE Self-Paced School Courses Algorithms Analysis of Algorithms Data Structures Interview Corner Languages ML & Data Science CS Subjects GATE Web Technologies Software Designs School Learning Mathematics Maths Notes (Class 8-12) NCERT Solutions RD Sharma Solutions Physics Notes (Class 8-11) Chemistry Notes CS Exams/PSUs ISRO UGC NET Student Post a Job Curated DSA Lists Tutorials Jobs Practice GBlog Puzzles What's New ? Change Language Data Structures Algorithms Interview Preparation Topic-wise Practice C++ Java Python Competitive ...

C files...?

C File Handling In this tutorial, you will learn about file handling in C. You will learn to handle standard I/O in C using fprintf(), fscanf(), fread(), fwrite(), fseek() etc. with the help of examples. A file is a container in computer storage devices used for storing data. Why files are needed? When a program is terminated, the entire data is lost. Storing in a file will preserve your data even if the program terminates. If you have to enter a large number of data, it will take a lot of time to enter them all. However, if you have a file containing all the data, you can easily access the contents of the file using a few commands in C. You can easily move your data from one computer to another without any changes. Types of Files When dealing with files, there are two types of files you should know about: Text files Binary files 1. Text files Text files are the normal .txt files. You can easily create text files using any simple text editors such as Notepad. When you open those fi...

what are Pointers....?

C - Pointers Advertisements Previous Page Next Page Pointers in C are easy and fun to learn. Some C programming tasks are performed more easily with pointers, and other tasks, such as dynamic memory allocation, cannot be performed without using pointers. So it becomes necessary to learn pointers to become a perfect C programmer. Let's start learning them in simple and easy steps. As you know, every variable is a memory location and every memory location has its address defined which can be accessed using ampersand (&) operator, which denotes an address in memory. Consider the following example, which prints the address of the variables defined − Live Demo #include int main () { int var1; char var2[10]; printf("Address of var1 variable: %x\n", &var1 ); printf("Address of var2 variable: %x\n", &var2 ); return 0; } When the above code is compiled and executed, it produces the following result − Address of var1 variable: b...

How to Drink Water

TAKE A GLASS OF WATER AND DRINK

How to Create Adsense Account

Image
  How to Create an AdSense Account? By Dinesh Stark Last updated on May 6, 2022 1140 Table of Contents Steps to Create an AdSense Account How to Login to the AdSense Account? 5 Mistakes to Avoid With Google AdSense FAQs Want to Become a Performance Marketer?  Want to learn the best way to monetize your  website traffic?  Then try learning Google AdSense. Every year Google pays over $10 billion to its content publishers. No contracts and a quick AdSense setup have made this Google program one of the most popular advertising tools. It allows site owners to generate high revenues from their web content. The platform is free to access, and the site owners get paid for clicks or impressions on the  Google ads  displayed on their website. Create an AdSense account, add the highest paying advertisements to your content, and get paid.  Advanced Pay Per Click Certification Program Get transformed into a paid marketing professional VIEW COURSE Steps to...