Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Introduction to Basic C Language Program Features & Syntax for Beginner

Introduction of C Programming    C is a general purpose programming language which was developed by Dennis Ritchie in 1973 at the bell laboratories. C programming language was developed for the UNIX operating system. The langu...

Memory Leak detection Program

Hello!! A Memory leak occurs when we did not manage the memory allocation in the programs, it is the type of resource leak. Memory leak reduces the performance because it reduces the memory of the system. It is common in those l...

How to compile and run C program in Ubuntu?

Hello friends, Today we will learn how to compile and run a C program in Ubuntu using the following steps: Step 1. Open your terminal. Step 2. Now type the following command: gedit cprg.c The above command open a text editor in whi...

C Program to Display the IP Address of the System

Hello Everyone, In this blog, We are going to know that how to display the ip address of the system using c programming. We can find the IP address, Gateway, Subnet Mask by typing ipconfig in command prompt. Here we are going to...

Local and Global Variables

Local Variables: Variables that are defined within a function or a block are called local variables. They can only be used within a function or a block. These can't be accessed outside their scope or we can say outside their function. ...

C program to show the implementation of array of pointers to strings...

/*=========================== Program to sort the strings in an array of pointers to strings =======/ /============================ By :Bipin Gosain ============================/ ============================= Date :27-5-2016 ============...

Storage Classes in C

The storage class in C are the one which defines the scope or life time of the variable and functions Four Different storage classes of C are : Auto  Register Static  Extern Auto Storage Class  Auto storage c...

Program in C to print your message without using semicolon

Program: You can print your message in C with using a semicolon. Let see how? e.g. Let us print the message Welcome in C. There is three ways: 1. Using switch: #include<stdio.h> void main(){ switch(p...

Check two Linked Lists are Identical or not in C

Program to check two Linked Lists are Identical or not in C. #include<stdio.h> #include<stdlib.h> /* Structure for a linked list node */ struct node { int data; struct node *next; }; /* Returns true if linked lists ...

Static functions in C

Static functions in C The static keyword with a function in C makes it Static function. The function without static keyword in C are global by default. The difference between them is static function are only accessible in the file in which it ...

Wild pointers in C

Wild pointers The pointers which are not initialized and are pointing to some random location are wild pointers. Pointers pointing to a known defined variable are not wild pointers but if it is pointing to a value or a set of values without va...

Difference between int main() and int main(void) in C.

Consider definition of int main(): int main() { return 0; } Consider definition of int main(void): int main(void) { return 0; } The above two definition work perfectly fine in C but the difference between two...

memcpy() in C

memcpy() This method as the name suggest memcpy() i.e memory copy is used to copy a number of bytes i.e a block of memory from one location to another location. Syntax of memcpy(): void * memcpy(void *to, const void *from, size_t numBy...

Program to print missing elements that lie in range 0 99

The logic of the program is to use a boolean array named presentseen of size 100, the size is defined by macro LIMIT. The boolean array is used to keep track of array elements that lie in range 0 to 99, which is initially initializ...

Program to count how many integers from 1 to N contains 0's as a digit

#include<bits/stdc++.h> using namespace std; int main() { int n,remainder,cnt=0,i,temp1; scanf("%d",&n); for(i=1;i<=n;i++) { temp1=i; while(temp1) { remainder=temp1%10; ...

Types of STL Containers

STL stands for Standard Template Library. This is a container used to store collection of similar objects. While declaring the container variable, we need to determine the type of element that container will hold. Adding and removing is done by t...

Efficient method to find maximum difference between two elements in C?

#include<stdio.h> int maxDiff(int a[], int n) { int maxDiff = -1; // Initialize Result int maxRight = a[n-1]; // Initialize max element from right side for (int i = n-2; i >= 0; i--) { if (a[i] &g...

Difference between two elements so that larger element appears after the smaller number in C?

#include<stdio.h> int maxDiff(int a[], int size) { int max_diff = a[1] - a[0]; int i, j; for(i = 0; i < size; i++) { for(j = i+1; j < size; j++) { if(a[j] - a[i] > max_diff) ...

Check whether two strings are anagram of each other in C with character count method?

# include <stdio.h> # define NO_OF_CHARS 256 bool areAnagram(char *str1, char *str2) //function checks whether two strings are anagrams. { // Create 2 count arrays and initialize all values as 0 int count1[NO_OF_CHARS] = {...

Check whether two strings are anagram of each other in C?

// C program to check whether two strings are anagrams #include <stdio.h> #include <string.h> void quickSort(char *arr, int si, int ei); //Function declared for sorting a string bool areAnagram(char *str1, char *str2) /...

Pointer Arithmetic

A pointer is a variable which is used to store the address as a value of another variable. Pointers are helpful with program's efficiency and allow us to handle unlimited amounts of data.   The following operations are performed wi...

Does C support function overloading?

Does C support function overloading? Function overloading is a feature available in most Object Oriented Languages such as C++ and Java. But C (not Object Oriented Language) doesnt support function overloading. Function overloading can be def...

How to find length of a string without string.h and loop in C?

Program to find length of a string without string.h and loop in C? #include <stdio.h> int main() { char s100]; printf( "\rLength is: %d", printf("Entered string is: %s\n", gets(s)) - 20); return 0; } output:...

Program to Convert String into Uppercase

Using library function: We can use toupper() library function present in "string.h" to convert string into uppercase. #include <stdio.h> #include <string.h> int main() { char str[100]; printf("Enter a string to co...

To Print Hello without using semi-colon

Printing Hello Without using semicolon: As we know to print something in C we use printf and ends it with semi-colon but we can print something without using semicolon. With Semicolon we print something like this: #include<stdio.h>...

Arithmetic operations by using only one variable

Hey Guys, Today we are going to perform Arithmetic operations by using only one variable. It means, if we have define a single variable for loops or anything else then it must be used for all the operation. So, here, your only friend is ...

Sort a stack using recursion in C?

Sort a stack using recursion in C Sort a stack means inserting elements in Stack in sorted order.The sorting is to be implemented using recursion. In this first a stack is created by pushing elements into it then by popping elements from it,so...

Printf() function inside another Printf(function)

What happens when you use a printf() function inside another printf() function. To understand this lets see the following example: #include<stdio.h> int main() { int number = 1234; printf("%d", printf("%d", printf("%d", number)))...

Reversing a string without using library function

In this c program we are reversing a string without using library function( Strrev). we are using a temporary variable store for reversing the string. #include<stdio.h> #include<string.h> int main() { char str[100], s...

Finding frequency of a character in a string

This program is all about finding how many times a character comes in a string. In the program there is a count variable which will be incremented if the same character appears again and then that count variable will be printed. #include &l...

PASSING ARGUMENT TO A FUNCTION BY REFERENCE IN C

Passing argument to a function by reference is also know as call by reference. In this method if we change the parameter given in the function will effect the argument. For passing a value by reference, we use pointers. As we use pointers in ca...

Program to check whether a number is Armstrong number

Program to check whether a number is Armstrong Number or not: Armstrong number is a positive number whose sum of cubes of all individual digits is equal to the number itself. Like 371(3x3x3+7x7x7+1x1x1=371) is an armstrong number as the sum of...

PASSING ARGUMENT TO A FUNCTION BY VALUE IN C

Passing argument to a function by value is also know as call by value. This method of passing arguments to a function copies the original value of argument into the formal parameter of a function. In other words if we change parameter which are ...

MACROS IN C

MACROS A macro is a piece of statements(code) which we provide a name or give that piece of statements a name. so whenever we used that name which we provide to that piece of code in the program, that code get replaced by the contents of the...

Program to count number of vowels and consonants in a string

Counting number of vowels,consonants and digits in a string: In this program we are counting how many vowels ,consonants and digits are in the string which will be entered by the user. After user inputs a string , string will be iterated from...

Parsing expression in Data structure

Firstly to understand the parsing expression in data structure we should know about the arithmetic notations. There are three ways of writing arithmetic notations which are having same meaning:- 1. Infix Notation 2.Prefix Notation 3.Postfix N...

Program to find power of a number

Program to find power of a number: In this program we are finding power of any number which will entered by the user and user will also enter a power. There is a function power which will return power of the number after calculating and Power...

Program to find largest of N numbers in an array

Finding largest number in an array: To find largest number in an array first user will enter the length for the array and then the user will input the elements for the array. There is a max variable taken in the program which is assigned 0th ...

How to swap two variables in one line in C?

How to swap two variables in one line in C? C program to swap two variables in single line #include <stdio.h> void main() { int a = 5; int b = 10; (a ^= b), (b ^= a), (a ^= b); printf("Swapped values of a and b ...

Enumerated Data Types

It gives an opportunity to invent our own data type and define what values the variable of this data type can take. This also helps in making the program more readable, which can be an advantage when a program gets complicated or when more than o...

Reverse a Singly Linked List in linear order of time

You can reverse a Singly Linked List in linear order of time by implementing the following iterative approach, there are other recursive approaches are also available. But for the sake of simplicity I am implementing the iterative approach only,...

Memset in C

Memset is used to fill first n bytes in the block of memory pointed by a pointer to a specific character interpreted as an unsigned char. Memset is defined under string.h header. Function Prototype void * memset ( void * ptr, int value, siz...

Program to sort elements in Ascending Order using Selection Sort in C language

Program to sort elements in Ascending Order using Selection Sort in C language Selection Sorting Definition:- It compare the array of number with the rest of number in the array list & takes the selected to the top of the list & agai...

Program to sort elements in Ascending Order using Insertion Sort in C language

Program to sort elements in Ascending Order using Insertion Sort in C language Insertion Sort Definition:- It is a sorting which sort one number at a time & insert to its proper location in the array list until all the numbers are sorte...

Program for Bubble Sort elements in Ascending Order

Program for Bubble Sort elements in Ascending Order Definition:- In Bubble sort each element compares with the other elements until finds its correct order place. This is repeated until all elements are in the order. //Header Files...

Program for factorial of a number using recursive function in C

What is Factorial ? Factorial of a no. means multiplying below numbers. Factorial is denoted by ! Exclamation mark Eg:- 5! means :- 5 * 4 * 3 * 2 * 1 = 120 What is a Recursive function? Definition:- A function which calls itself is...

What is Fibonacci Series & program for it?

What is Fibonacci Series ? Fibonacci succession arrangement or group of the numbers beginning with zero or one followed by a one, and carry on with rule that number is equivalent to the sum of prior 2 numbers. Fibonacci series is denoted by f...

Dynamic Memory Allocation using malloc() in C

The malloc is an acronym of "memory allocation". This function allocates the requested size of bytes to a variable and return a pointer of type void. Syntax: p=(type cast *)malloc(size) Here p is a pointer. Example: Calculate the s...

Program in c to print 1 to 100 without using loop

in this program of C language we are not using the any king of loop,we are printing the numbers without loop. #include int main(){ int num = 1; print(num); //it is a function which is calling the value of pri...

How to convert string to int without using library functions in c

here we are converting string values to the integer without using library functions. #include int stringToInt(char[] ); int main(){ char str[10]; int intValue; printf("Enter any integer as a string:...
prev 1
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: