Bhanu Priya has Published 1449 Articles

How to pass the address of structure as an argument to function in C language?

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 09:39:31

577 Views

Passing the address of structure as an argument to function −The Address of the structure is passed as an argument to the function.It is collected in a pointer to structure in function header.AdvantagesNo wastage of memory as there is no need of creating a copy againNo need of returning the ... Read More

How to pass individual members of structure as arguments to function in C language?

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 09:38:44

977 Views

Passing individual members as arguments to function −Each member is passed as an argument in the function call.They are collected independently in ordinary variables in function header.Example#include //Declaring structure// struct student{    int s1, s2, s3; }s[5]; //Declaring and returning Function// void addition(int a, int b, int c){    //Declaring ... Read More

How to pass entire structure as an argument to function in C language?

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 09:37:28

895 Views

Passing entire structure as an argument to function −Name of the structure variable is given as argument in function call.It is collected in another structure variable in function header.DisadvantageA copy of the entire structure is created again wasting memoryProgramFollowing program demonstrates passing an entire structure as an argument to function ... Read More

Explain structures using typedef keyword in C language

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 09:36:17

563 Views

Typedef‘C’ allows to define new datatype names using the ‘typedef’ keyword. Using ‘typedef’, we cannot create a new datatype but define a new name for already existing type.Syntaxtypedef datatype newname;Exampletypedef int bhanu; int a; bhanu a; %dThis statement tells the compiler to recognize ‘bhanu’ as another name for ‘int’.‘bhanu’ is ... Read More

Declaring a structure with no members in C language

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 09:35:11

1K+ Views

ProblemCan we declare a structure with no members in C, if yes what will be the size of that structure?SolutionYes, it is allowed in C programming language that we can declare a structure without any member and in that case the size of the structure with no members will be ... Read More

How to create a customized atoi() function in C language?

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 09:31:03

184 Views

The atoi() is predefined function used to convert a numeric string to its integer value.Create a customized atoi()The atoi() only converts a numeric string to integer value, so we need to check the validity of the string.If this function encounters any non-numeric character in the given string, the conversion from ... Read More

Finding number of alphabets, digits and special characters in strings using C language

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 09:20:25

777 Views

Following is the logic we implement to find alphabets, digits and special characters −for(number=0;string[number]!='\0';number++) {// for loop until endof string    if(string[number]>='a'&&string[number]='A'&&string[number]='0'&&string[number]='a'&&string[number]='A'&&string[number]='0'&&string[number]

What are character analysis function, explain with C program?

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 09:17:07

249 Views

Character analysis and conversion functionsThe predefined functions in “ctype.h” library is for analyzing the character input and converting them.Analysis functionsS.NoFunctionDescription1isalpha()An alphabet or not2isdigit()A digit or not3isspace()A space, a new line or tab4ispunct()A special symbol or not5slower()A lower case letter of alphabet6isupper()An upper case letter of alphabet7isalphanumeric()An alphabet/digit or notConverting functionsFunctionDescriptiontolower()Converts ... Read More

Write a C program to convert uppercase to lowercase letters without using string convert function

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 08:57:45

10K+ Views

Before going to know about how to convert upper case to lower case letters without string convert function.Let us have a look on program to convert upper to lower using convert function, then you will get a clarity on what we are doing in the program −Example#include #include ... Read More

Write a C program demonstrating strlen library function

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 08:56:47

296 Views

The strlen () functionIt returns the number of characters in a string.Syntaxint strlen (string name)In this program, with the help of gets function reading the name at run time and trying to print the length of that name using strlen() function, this function returns an integer value and try to ... Read More

Advertisements