C strlen()

C strlen(): String Functions are the built-in functions provided by C to operate and manipulate a string. C strlen() function returns the length of a string. Syntax: strlen (string name) Example: #include<stdio.h> #include <string.h>   void main() { char str[10] = "Hello C."; int b; b = strlen (str); printf ("%d\n",b); }#include<stdio.h> #include <string.h> void … Read more

Categories C

C String Functions

String Functions are the built-in functions provided by C to operate and manipulate a string. C provides a number of string functions. Some of the MOST USED string functions are listed below: FUNCTION SYNTAX USES strlwr() strlwr (string ) Converts a string to lowercase letters. strupr() strupr (string ) Converts a string to uppercase letters. … Read more

Categories C

C gets() & puts()

C gets() function: C library facilitates a special function to read a string from a user. This function is represented as gets() function and is defined in the <stdio.h> header file of C. C puts() function: C library also facilitates a special function to print a string on the console screen. This function is represented … Read more

Categories C

String in C

C Strings: A sequence of characters, internally stored in the form of an array of characters is called as string. Declaration of String: In C, a string can be specified in two ways: Character Array: A string declared as an array, where each character represents an element of that array, is called as Character Array. … Read more

Categories C

C Dynamic memory allocation

In Static Memory Allocation, memory is allocated at compile time, that can’t be modified while executing program and is generally used in array. In Dynamic Memory Allocation, memory is allocated at run time, that can be modified while executing program and is generally used in linked list. Methods used for Dynamic memory allocation: Method Syntax … Read more

Categories C

C Pointer Arithmetic

Pointer Arithmetic in C: C pointers can be defined as a variable, pointing towards the address of a value. C also facilitates Arithmetic operations with Pointers. Some of these are: C Pointer Increment: Incrementing a pointer in C simply means to increase the pointer value step by step to point to the next location. Logic: … Read more

Categories C

C Pointer to Pointer

C pointers can be defined as a variable, pointing towards the address of a value. When a pointer refers to the address of another pointer, it is called as Pointer to Pointer in C. Syntax: Data_type **variable_Name; Example: #include<stdio.h>   void main() { int n = 60784; int *a; int **b; a = &n; b … Read more

Categories C

C Pointers

C pointers can be defined as a variable, pointing towards the address of a value. Syntax: Data_type *variable_Name; Advantages of using Pointers in C: Improves the performance. Frequently used in arrays, structures, graphs and trees. Less number of lines needed in a code. Useful in accessing any memory location. Used in Dynamic Memory Allocation. NULL … Read more

Categories C

C Array to Function

Arguments are the variables, inside the parentheses, after the function name which is used to pass informations to functions. Beside passing variables and pointers, arrays can also be passed as a function parameter or argument. Syntax: Return_type functionName (Data_type array Name[]) {     code to be executed; } Example: #include<stdio.h>   int maximum(int a[],int size) … Read more

Categories C

c multi dimensional array

A multidimensional array is an array containing two, three, four, five, or more arrays. The increasing number of dimensions, increases the code complexity for the developers. The most popular arrays are single, two and three dimensional arrays. Two dimensional Arrays: A C two-dimensional array can be defined as an array of arrays that needs two … Read more

Categories C