
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

4K+ Views
ProblemFind out the maximum and minimum from an array using dynamic memory allocation in C.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 −The malloc () − allocates a block of memory in bytes at runtime.The calloc () − allocates continuous blocks of memory at runtime.The realloc () − used to reduce (or) extend the allocated memory.The free () − deallocates previously allocated memory space.Finding maximum and minimum number in an array using dynamic memory allocationThe logic for finding maximum element in an ... Read More

3K+ Views
ProblemLet’s write a C program to compute the row sum and column sum of a 5 x 5 array using run time compilation.SolutionIn this program, we are entering the values of array which is of size 5X5 matrix during runtime in the console, with the help of for loops we are trying to add rows and columns.Logic for doing row sum is given below −for(i=0;i

477 Views
Tensorflow is a machine learning framework that is provided by Google. It is an open-source framework used in conjunction with Python to implement algorithms, deep learning applications and much more.TensorFlow is used in research and for production purposes and has optimization techniques that help in performing complicated mathematical operations quickly. This is because it uses NumPy and multi-dimensional arrays. These multi-dimensional arrays are also known as ‘tensors’. The framework supports working with deep neural network. It is highly scalable, and comes with many popular datasets. It uses GPU computation and automates the management of resources. It comes with multitude of ... Read More

677 Views
ProblemWhat is the logic in C language to print the numbers in different formats like pyramid, right angle triangle?SolutionTo print the numbers or symbols in different model we can take the help of for loop in the code.Example1Following is the C program to print pyramid − Live Demo#include int main(){ int n; printf("Enter number of lines: "); scanf("%d", &n); printf(""); // loop for line number of lines for(int i = 1; i

19K+ Views
Let’s take the concept of arrays to about compile time and run time initialization −ArrayArray is a collection of items stored at contiguous memory locations and elements can access by using indices.Compile time array initializationIn compile time initialization, user has to enter the details in the program itself.Compile time initialization is same as variable initialization. The general form of initialization of array is as follows −Syntaxtype name[size] = { list_of_values }; //integer array initialization int rollnumbers[4]={ 2, 5, 6, 7}; //float array initialization float area[5]={ 23.4, 6.8, 5.5, 7.3, 2.4 }; //character array initialization char name[9]={ 'T', 'u', 't', 'o', ... Read More

2K+ Views
ProblemCompiler not reading the string after integer in C programming? How can we solve this problem?SolutionWhen you enter an integer number and press enter to read next value, compiler stores null into the string’s first char and string input terminates. Because scanf will terminate whenever it reads a null character.How to Solve It?When we are trying to read string or character after int or float, we should read a temporary char which is present in the input buffer.The following is the program without errors −Example Live Demo#include struct student{ char name[10]; int roll; char temp; } s; ... Read More

1K+ Views
ProblemCommon error occurred while reading string and numeric data using scanf() function in C languageSolutionThe scanf() function is used to read formatted input from stdin in C language. It returns the whole number of characters written in it otherwise, returns a negative value.Generally in case of scanf() function while reading string values after integer from the user, we get frequent errors.ExampleFollowing is a C program which reads roll number (integer value) and name of a student − Live Demo#include struct student { char name[10]; int roll; } s; int main(){ printf("Enter information of students:"); printf("Enter roll ... Read More

7K+ Views
ProblemTry to print a name 10 times without using any loop or goto statement in C programming language.SolutionGenerally, looping statements are used to repeat the block of code until condition is false.Example1In this program, we are trying to print a name 10 times without using loop or goto statements. Live Demo#include void printname(char* name,int count){ printf("%03d : %s",count+1,name); count+=1; if(count

5K+ Views
Yes, we can give arguments in the main() function.Command line arguments in C are specified after the name of the program in the system’s command line, and these argument values are passed on to your program during program execution.The argc and argv are the two arguments that can pass to main function.But main() function is actually called by the operating system (or shell program) when you run the program from the terminal.SyntaxThe syntax is explained below −int main(int argc, char *argv[]){ //Code return 0; }Example Live Demo#include int main(int argc, char *argv[]){ int i; for (i = ... Read More

518 Views
Implicit type conversion is done by the compiler by converting smaller data type into a larger data type.For example, ASCII value of A=65.In this program, we are giving character ‘A’ as input, now write a code to convert A to 65 which is its ASCII value.ExampleFollowing is the example to find ASCII value of uppercase character ‘A’ using implicit conversion − Live Demo#include int main(){ char character = 'A'; int number = 0, value; value = character + number; //implicit conversion printf("The ASCII value of A is: %d", value); return 0; }OutputThe ASCII value of ‘A’ ... Read More