Category: C Tutorial

C Pointer Arithmetic 0

C Pointer Arithmetic

1. What is Pointer Arithmetic? Pointer arithmetic allows you to move a pointer through memory based on the size of the data type it points to. You can perform arithmetic operations like: Increment: ptr++...

C Pointers and Arrays 0

C Pointers and Arrays

1. Array Name as a Pointer In C, the name of an array is treated as a pointer to its first element. That means:

  numbers → address of the first element (numbers[0])...

C Pointers 0

C Pointers

1. What is a Pointer? A pointer is a variable that stores the memory address of another variable. Instead of holding a value directly, it holds where the value is stored. Syntax:

 ...

C Memory Address 0

C Memory Address

1. What is a Memory Address? Every variable in C is stored at a specific location in memory. The memory address is the location where the variable’s value is stored. You can find the...

C User Input 0

C User Input

1. Basic Input Functions In C, user input is mainly taken using: scanf() → Reads formatted input getchar() → Reads a single character gets() → Reads a string (unsafe, avoid using) fgets() → Reads...

C String Functions 0

C String Functions

1. Include the Header #include <string.h> All standard string functions are defined in <string.h>. 2. Common C String Functions Function Description Example strlen(str) Returns the length of a string (excluding \0) int len =...

C Special Characters 0

C Special Characters

1. What are Special Characters in C? Special characters are prefixed with a backslash \. They are used for newline, tab, quotes, backslash, etc. Mainly used in strings and character constants. 2. Common Special...

C Strings 0

C Strings

1. What is a String in C? In C, a string is an array of characters terminated by a null character \0. The null character \0 marks the end of the string. Example of...

C Multidimensional Arrays 0

C Multidimensional Arrays

1. What is a Multidimensional Array? A multidimensional array is an array of arrays. The most common is a 2D array, which can be thought of as a table with rows and columns. Syntax...

C Arrays – Real-Life Examples 0

C Arrays – Real-Life Examples

1. Storing Marks of Students Suppose you have 5 students and want to store their marks. Instead of creating 5 separate variables, use an array:

  Output: Student 1: 85 marks Student 2:...