Category Archives: Library

16. C – goto Statement

The goto statement allows us to transfer control of the program to the specified label. Syntax of goto Statement The label is an identifier. When the goto statement is encountered, the control of the program jumps to label: and starts executing the code. Example: goto Statement Output 1. Enter a number: 3 2. Enter a number: 4.3 3. Enter a number: 9.3 4. Enter… Read More »

17. C – break Statement

The break statement ends the loop immediately when it is encountered. Its syntax is: The break statement is almost always used with if…else statement inside the loop. How does the break statement work? Example: break statement Output Enter a n1: 2.4 Enter a n2: 4.5 Enter a n3: 3.4 Enter a n4: -3 Sum = 10.30 This… Read More »

18. C – continue Statement

The continue statement skips the current iteration of the loop and continues with the next iteration. Its syntax is: The continue statement is almost always used with the if…else statement. How continue statement works? Example: continue statement Output Enter a n1: 1.1 Enter a n2: 2.2 Enter a n3: 5.5 Enter a n4: 4.4 Enter a n5: -3.4 Enter a n6:… Read More »

19. C – Single Dimension Array

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… Read More »

20. C – Multidimensional Arrays

In C programming, you can create an array of arrays. These arrays are known as multidimensional arrays. For example, Here, x is a two-dimensional (2d) array. The array can hold 12 elements. You can think the array as a table with 3 rows and each row has 4 columns. Similarly, you can declare a three-dimensional (3d) array.… Read More »

21. C – Arrays & Functions

Pass arrays to a function in C In C programming, you can pass an entire array to functions. Before we learn that, let’s see how you can pass individual elements of an array to functions. Passing individual array elements Passing array elements to a function is similar to passing variables to a function. Example 1: Passing… Read More »

22. C – Strings

In C programming, a string is a sequence of characters terminated with a null character \0. For example: When the compiler encounters a sequence of characters enclosed in the double quotation marks, it appends a null character \0 at the end by default. Strings are actually a one-dimensional array of characters terminated by a null character ‘\0’. Thus a null-terminated… Read More »

23. C – Pointers

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.… Read More »

24. C – Pointer Arithmetic and Comparision

A pointer in c is an address, which is a numeric value. Therefore, you can perform arithmetic operations on a pointer just as you can on a numeric value. There are four arithmetic operators that can be used on pointers: ++, –, +, and – To understand pointer arithmetic, let us consider that ptr is an integer… Read More »

25. C – Null Pointer

A null pointer is a pointer which points nothing. Some uses of the null pointer are: To initialize a pointer variable when that pointer variable isn’t assigned any valid memory address yet. To pass a null pointer to a function argument when we don’t want to pass any valid memory address. To check for a… Read More »