C Array of Structures

C Array of Structures: In order to store multiple data of different data types, an array of structures is used. Example: #include<stdio.h> #include <string.h>   struct student { int roll_no; char name[30]; };   void main( ) { struct student s[3]; int i;   s[0].roll_no = 1; strcpy(s[0].name, "Vibhuti Singh"); s[1].roll_no = 2; strcpy(s[1].name, "Yashvendra … Read more

Categories C

C Structure

C Structure: Among other data types like int, array, string, etc, C facilitates a very unique data type that can hold elements of different data types in a single variable and thus is often called as an user-defined data type. Any information about a person, class or product, etc. is best stored in a structure … Read more

Categories C

C Math Functions

C Math Functions: Math functions and constants are already defined in the C library, in <math.h> header file, which can be used to perform mathematical calculations. C provides various math functions including; abs() function: This function is used to get an absolute value of a number. Syntax: abs ( number ) ceil() function: This function … Read more

Categories C

C strstr()

C strstr(): String Functions are the built-in functions provided by C to operate and manipulate a string. C strstr() function returns substring from first match till the last character. Syntax: char *strstr(const char *string, const char *match) Example: #include<stdio.h> #include <string.h>   void main() { char str[50]="Hello! C you there C."; char *s;   s … Read more

Categories C

C strupr()

C strupr(): String Functions are the built-in functions provided by C to operate and manipulate a string. C strupr() function converts a string to uppercase letters. Syntax:  strupr (string ) Example: #include<stdio.h> #include <string.h>   void main() { char str[10] = "Hello C."; printf("%s",strupr(str)); }#include<stdio.h> #include <string.h> void main() { char str[10] = "Hello C."; … Read more

Categories C

C strlwr()

C strlwr(): String Functions are the built-in functions provided by C to operate and manipulate a string. C strlwr() function converts a string to lowercase letters. Syntax: strlwr (string ) Example: #include<stdio.h> #include <string.h>   void main() { char str[10] = "Hello C."; printf("%s",strlwr(str)); }#include<stdio.h> #include <string.h> void main() { char str[10] = "Hello C."; … Read more

Categories C

C strrev()

C strrev(): String Functions are the built-in functions provided by C to operate and manipulate a string. C strrev() function reverses a string. Syntax: strrev (string ) Example: #include<stdio.h> #include <string.h>   void main() { char str[10] = "Hello C."; printf("%s",strrev(str)); }#include<stdio.h> #include <string.h> void main() { char str[10] = "Hello C."; printf("%s",strrev(str)); } Output … Read more

Categories C

C strcmp()

C strcmp(): String Functions are the built-in functions provided by C to operate and manipulate a string. C strcmp() function compares two strings and returns 0 value if the strings are same, else it returns 1. Syntax: strcmp(string1, string2) Example: #include<stdio.h> #include <string.h> #include <stdbool.h>   void main() { char str1[10] = "Hello C. "; … Read more

Categories C

C strcat()

C strcat(): String Functions are the built-in functions provided by C to operate and manipulate a string. C strcat() function concatenates two strings. Syntax: strcat(string1, string2) Example: #include<stdio.h> #include <string.h>   void main() { char str1[10] = "Hello C. "; char str2[20] = "Hello World."; strcat(str1, str2); puts(str1); }#include<stdio.h> #include <string.h> void main() { char … Read more

Categories C

C strcpy()

C strcpy(): String Functions are the built-in functions provided by C to operate and manipulate a string. C strcpy() function copies a string from source to destination. Syntax:  strcpy(destination, source) Example: #include<stdio.h> #include <string.h> #include <stdbool.h>   void main() { char str1[10] = "Hello C."; char str2[10];   strcpy(str2, str1); puts(str2); }#include<stdio.h> #include <string.h> #include … Read more

Categories C