C Programming
- Write a program to store the name, runs, scored and wickets taken of n cricketer #include<stdio.h> struct cricketer int runs,wickets; char name[25]; player[100],t; void main() int i,j,n; printf("Enter the no of cricket pl... 1
- Comparison between union and structure S.no C Structure C Union 1 Structure allocates storage space for all its members separately. Union allocates one common storage space for al... 1
- Comparison between array and structure. Answer: An array is a collection of elements of the same data type accessed by an index, while a structure is a collection of members of dif... 1
- Write a program to check whether the enter string is palindrome or not. #include<stdio.h> #include<conio.h> #include<string.h> int main(){ char str[20]; int i, len, temp=0; int flag = 0; printf("Enter a string:")... 1
- Write a program to add two matrices m x n #include<stdio.h> int main() int i, j, rows, columns, a[10][10], b[10][10]; int arr[10][10]; printf("n Please Enter Number of rows and colum... 1
- Write a program to accept ‘n’ integer from user into an array and display them in one each line. Answer: Read n, store the n integers in an array with one loop, then print a[i] followed by a newline in a second loop. #include <stdio.h> i... 1
- Explain the recursive function. Write a program to find the factorial of a number using recursive function. A function that calls itself is called as a recursive function and the implementation of a program that uses recursive function is called as... 1
- Write syntax of break and continue statement with example. It is sometimes desirable to skip some statements inside the loop or terminate the loop immediately without checking the test expression. In... 1
- WAP to find greatest of three number using conditional operator #include<stdio.h> void main() int i,j,k; printf("Enter three no.n"); scanf("%d%d%d",&i,&j,&k); int re=(i>j)?((i>k)?i:k):((j>k)?j:k); printf(... 1
- Explain the concept of nested structure with suitable example. Structure written inside another structure is called as nesting of two structures. Nested Structures are allowed in C Programming Language.... 1
- Write a program to store the information of student using structure. #include <stdio.h> struct student char name[50]; int roll; float marks; s[100]; int main() int i,n; struct student s[100]; printf("Enter tot... 1
- Explain pointer to pointer with example. Answer: a pointer to pointer (double pointer) is a variable that stores the address of another pointer variable. It is declared with two ast... 1
- Explain the difference between function call by value and function call by reference with suitable programmes. Answer: In call by value a copy of the actual argument is passed, so changes inside the function do not affect the caller. In call by refere... 1
- What is String? Explain any five string functions with example which is available in String.h. Answer: a string in C is an array of characters ending with the null character '\0'. The header string.h provides functions such as strlen,... 1
- Write a menu driven program and perform following operations on matrices such as transpose of matrix #include <stdio.h> #define MAX_SIZE 10 void read_matrix(int matrix[][MAX_SIZE], int rows, int cols) printf("Enter matrix elements:n"); for (... 1
- Write a recursive function and calculate factorial of inputted integer number. Answer: a recursive function calls itself with n-1 until it reaches the base case, using n! = n×(n-1)! and 0! = 1! = 1. #include <stdio.h> l... 1
- WAP to compute permutation and combination values using function. Answer: write a factorial function and two functions that use it: ⁿP_r = n!/((n-r)!) and ⁿC_r = n!/(r! (n-r)!). #include <stdio.h> long long... 1
- Explain the storage classes with example. Answer: C has four storage classes: automatic (auto), register, static and external (extern). They differ in storage location, default value... 1
- What are keywords ? List the keywords Answer: Keywords are reserved words that have a fixed, predefined meaning for the C compiler. They cannot be used as identifiers (variable,... 2
- Write a program to swap two numbers using function using call-by-value method call-by-reference method Answer: with call by value the swap happens only on copies, so the original variables do not change; with call by reference (passing address... 1
- Write a program to store and display name, marks in three subjects and roll number of n students using structure. Answer: define a structure with roll number, name and three marks, make an array of it, and read and print n records with loops. #include <s... 1
- Write a program to check whether an inputted string is palindrome or not. Answer: compare characters from both ends moving inward; if all pairs match, the string is a palindrome. #include <stdio.h> #include <string... 1
- Write a program to count vowels, consonants, digits and blank spaces in an inputted string. Answer: read the string, then check each character and increase the matching counter. #include <stdio.h> #include <ctype.h> int main() char... 1
- Write a program to multiply two matrices. A program to multiply two matrices. #include<stdio.h> void multiply(int mat1[12][12],int mat2[12][12],int ,int ,int ); void main() int mat1[... 1