Solution of C Programming, BCA 2nd Semester
Solution of C Programming, BCA 2nd Semester
Write a progam that illustrate how pointer variable change the value of
normal variable.
In programming, a pointer is a variable that holds the memory address of another variable. Pointers
are commonly used in programming to access and manipulate data stored in memory.
Here's an example program in C that illustrates how a pointer variable can change the value of a
normal variable:
#include <stdio.h>
#include <conio.h>
int main( ) {
int x = 5; // declare and initialize a normal variable x with value 5
int *p; // declare a pointer variable p that can point to an integer
Q.No. 8 Solution
#include <stdio.h>
#include <graphic.h>
int main() {
int gd = DETECT, gm;
initgraph(&gd, &gm, "");
setcolor(YELLOW);
circle(x, y, r);
getch();
closegraph();
return 0;
}
Q.no. 9 solution
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_PLAYERS 20
int main() {
struct player players[MAX_PLAYERS];
struct player* players_ptr[MAX_PLAYERS];
int i;
for (i = 0; i < MAX_PLAYERS; i++) {
printf("Enter details for player %d:\n", i+1);
printf("Name: ");
scanf("%s", players[i].name);
return 0;
}
Here's the C code to compute the sum of the series 1+x/1! + x2/2! + x3/3! + …… + xn/N!:
#include <stdio.h>
int main()
{
int n, i;
float x, sum = 1.0, term = 1.0;