PSC Test 3 (1) .N
PSC Test 3 (1) .N
In call by value, the function receives a copy of the variable’s value. Any
modifications made to the parameter inside the function do not affect the
original value.
#include<stdio.h>
return a + b;
int main()
func_ptr = &add;
int x = 10,
// Output: 30
return 0;
In this example, the values of x and y are passed to the function pointer
func_ptr, which points to the add function. The values are passed by
value, meaning the original values of x and y are not modified.
2. Pointer to Function with Call by Reference
#include<stdio.h>
*a = *b;
*b = temp;
int main()
func_ptr = &swap;
int x = 10,
y = 20;
func_ptr(&x, &y);
// Output:
x = 20,
y = 10
return 0; }
#include <stdio.h>
#include <string.h>
#define MAX_EMPLOYEES 50
typedef struct
} Employee;
int main()
int i, num_employees;
scanf("%d", &num_employees);
scanf("%d", &employees[i].eno);
printf("Enter employee name: ");
scanf("%f", &employees[i].salary);
return 0;
#include <stdio.h>
#include<string.h>
int main() {
char ch;
printf("Enter name of source file: ");
scanf("%s", sourceFileName);
scanf("%s", destFileName);
if (sourceFile == NULL) {
return 1;
if (destinationFile == NULL) {
fclose(sourceFile);
return 1;
fputc(ch, destinationFile);
fclose(sourceFile);
fclose(destinationFile);
return 0;
void main()
float r = 3.5, x;
x = AREA (r);
5.Illustrate to draw basic graphics like line, circle, arc, ellipse and
rectangle.
#include <graphics.h>
#include <stdio.h>
int main()
circle(300,300,150);
rectangle(100,100,250,350);
getch();
closegraph();
return 0;
}
1.Write down the difference between Structure and Union.
structure union
Keyword struct is used to define a Keyword union is used to define a
structure union.
Each member have the own Memory allocated is shared by
independent memory. individual member of union.
Individual member can be accessed at Only one member can be accessed at
a time. a time.
All members of a structure can be Only the first member can be initialized.
initialized.
Syntax: structstructure_name union union_name
{ {
datatype members1; datatype members1;
datatype members2; datatype members2;
…………………….
…………………….
datatype membersn;
datatype membersn; };
};
2.What is a pointer?
Syntax:
datatype*pointername;
Output: 10
SEEK_CUR- starts the offset from the current location of the cursor in the
file