//https://[Log in to view URL]
#include <stdio.h>
#include <stdlib.h>
int main() {
int n=1,i,j;
int *ptr;
ptr=(int*)malloc(n*sizeof(int));
for(i=0;i<n;i++){ //n is very important here
scanf("%d",ptr+i);// it only reads the values of input till ' '
}
for(j=0;j<n;j++){
printf("%d",*(ptr+j));
}
free(ptr);
return 0;
}
#if 0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
int *a;
a =(int*)malloc(10*sizeof(int));
memset(a,0,10*sizeof(int));
for(int i=0;i<10;i++){
scanf("%1d",&a[i]);
}
for(int i=0;i<10;i++){
printf("%d",a[i]);
}
free(a);
}
int main(){
int *ptr;
int n=1;
ptr=(int*)malloc(n*sizeof(int));
scanf("%d",ptr);
printf("%d",*ptr);
}
char *ptr;
ptr=(char*)malloc(n*sizeof(char));
for(i=0;i<n;i++){
scanf("%s",ptr+i);
}
for(j=0;j<n;j++){
printf("%s",ptr+j);
}
char *ptr;
ptr=(char*)malloc(n*sizeof(char));
for(i=0;i<n;i++){
scanf("%c",ptr+i);
}
for(j=0;j<n;j++){
printf("%c",*(ptr+j));
}
#endif
To embed this program on your website, copy the following code and paste it into your website's HTML: