-
Notifications
You must be signed in to change notification settings - Fork 0
/
Registration
34 lines (33 loc) · 923 Bytes
/
Registration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int *ptr;
int n,i,e;
char *ptr1;
char answer;
n=1;
i=0;
ptr=(int*)malloc(n*sizeof(int));
ptr1=(char*)malloc(n*sizeof(char));
printf("Enter the roll number of the student:");
scanf("%d",&ptr[0]);
printf("Enter the name of the student:");
scanf("%s",&ptr1[0]);
printf("Do you want to enter any more participants(Y/N):");
scanf(" %c",&answer);
do{
i=i+1;
e=n+i;
ptr=realloc(ptr,e*sizeof(int));
ptr1=realloc(ptr1,e*sizeof(char));
printf("Enter The roll number of the student:");
scanf("%d",&ptr[i]);
printf("Enter the name of the student:");
scanf("%s",&ptr1[i]);
printf("Do You Want to enter any more participants(Y/N):");
scanf(" %c",&answer);
}while ( answer == 'Y' || answer == 'y');
printf("Exit");
}