Jan

17

#include<conio.h>
#include<stdio.h>
#include<alloc.h>
void main(){
int *intPtr,*intPtr2,i;
intPtr=(int*) calloc(15,sizeof(int));
intPtr2=(int*) malloc(15*sizeof(int));
intPtr=realloc(intPtr,20);

//for(i=0;i<5;i++)
//scanf(“%d”,intPtr+i);

for(i=0;i<15;i++){
printf(“Integers: %d\n”,*(intPtr+i));
}

for(i=0;i<5;i++)
scanf(“%d”,intPtr2+i);

for(i=0;i<15;i++){
printf(“Integers: %d\n”,*(intPtr2+i));
}
free(intPtr);
free(intPtr2);
}

—————————————————————————————–

#include<conio.h>
#include<stdio.h>
#include<alloc.h>
void main(){
char *charPtr;
int count=0;
charPtr=(char*) malloc(10*sizeof(char));

scanf(“%s”,charPtr);
printf(“String: %s\n”,charPtr);

while(*charPtr!=’\0′){
printf(“%c\n”,*charPtr);
charPtr++;
count++;
}
printf(“\nLength = %d\n”,count);
free(charPtr);
}


Leave a Reply

Filled Under: C Programming