
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

778 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]

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 an upper case alphabet to lower casetoupper()Converts a lower case alphabet to upper caseExampleLet us see a program to demonstrate character analysis and conversion functions − Live Demo#include #include void main(){ //Initializing compile time character variable// char variable = 'A'; //Reading User I/P// //printf("Enter the character : "); ... Read More

298 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 print that no using printf.Example 1 Live Demo#include #include void main(){ //Declaring string and length// char name[25]; int length; //Reading Input from user// printf("Enter your name : "); gets(name); length=strlen(name); //Printing name// printf("Your name is : "); puts(name); printf("Length of ... Read More

451 Views
Pointer is a variable which stores the address of other variable.Features of PointersFollowing are the features of pointers −Saves the memory spaceExecution time is faster because of direct access to memory location.The memory is accessed efficiently with the pointer i.e. dynamically memory is allocated and deallocated.Pointers are used with data structures.Here is an example for search demonstration −We can access and print a particular character in a string by using pointers.Following example shows how to access the elements using pointer −Example Live Demo#include int main(){ char array[5] = "Tutorial", *ptr, i, *ptr1; ptr = &array[1]; ptr1 = ptr ... Read More

1K+ Views
ProblemWrite a C program to calculate sum and product of all elements in two-dimensional array using run time compilation.SolutionRuntime compilation or initialization is also called as dynamic allocation. Allocation of memory at the time of execution (run time) is known as dynamic memory allocation.The functions calloc() and malloc() support allocating of dynamic memory.In this program, we will calculate the sum of all elements and product of all elements of two-dimensional array at run time.Logic for computing sum of all elements in 2D array −printf("Sum array is : "); for(i=0;i

13K+ Views
Dynamic Memory AllocationAllocation of memory at the time of execution (run time) is known as dynamic memory allocation.The functions calloc() and malloc() support allocating of dynamic memory.Dynamic allocation of memory space is done by using these functions when value is returned by functions and assigned to pointer variables.In this case, variables get allocated only if your program unit gets active.It uses the data structure called heap for implementing dynamic allocation.There is memory reusability and memory can be freed when not required.It is more efficient.In this memory allocation scheme, execution is slower than static memory allocation.Here memory can be released at ... Read More

1K+ Views
ProblemTo compute sum of even numbers and odd numbers in a set of elements using dynamic memory allocation functions.SolutionIn this program, we are trying to find even and odd numbers in a set of numbers.The logic used to find even numbers in a set elements is given below −for(i=0;i

13K+ Views
ProblemFind the sum of n numbers entered by user using dynamically allocated memory using C programming.SolutionThe Dynamic memory allocation enables the C programmers to allocate memory at runtime.The different functions that we used to allocate memory dynamically at run time are −malloc () − allocates a block of memory in bytes at runtime.calloc () − allocating continuous blocks of memory at run time.realloc () − used for reduce (or) extend the allocated memory.free () − deallocates previously allocated memory space.Following C program is to display the elements and calculate sum of n numbers.Using dynamic memory allocation functions, we are trying ... Read More

5K+ Views
ProblemExplaining the array post and pre incremented concept with the help of C program.SolutionIncrement operator (++) −It is used to increment the value of a variable by 1There two types of increment operators − pre increment and post increment.Increment operator is placed before the operand in preincrement and the value is first incremented and then operation is performed on it.eg: z = ++a; a= a+1 z=aIncrement operator is placed after the operand in post increment and the value is incremented after the operation is performed.eg: z = a++; z=a a= a+1Let’s consider an example to access particular elements in memory ... Read More

4K+ Views
Pointer is a variable which stores the address of other variable.Pointer declaration, initialization and accessingConsider the following statement −int qty = 179;Declaring a pointerint *p;‘p’ is a pointer variable that holds the address of another integer variable.Initialization of a pointerAddress operator (&) is used to initialize a pointer variable.int qty = 175; int *p; p= &qty;Let’s consider an example how the pointer is useful in accessing the elements in an array of string.In this program, we are trying to access an element which is present at particular location. The location can be found by using an operation.By adding pre incremented ... Read More