Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- void main(){
- char *str;
- str = (char *)malloc(sizeof(char));
- int size=1;
- char c;
- do{
- printf("Enter Char: ");
- scanf("%c",&c);
- if(c!='.')
- {
- str[size-1]=c;
- str = realloc(str,sizeof(char) * size+1);
- size++;
- }
- }while(c!='.');
- str[size]='\0';
- int i=0;
- while(str[i]!='\0')
- printf("%c",str[i++]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement