Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main(int argc,char* argv[]){
- printf("Adj meg egy tetszoleges stringet:");
- char* s=malloc(1);s[0]=0;/* stirng inicializalas*/
- {/* stirng beolvasas
- meret elore nem ismert*/
- int meret=1;
- char c;
- while ((c=getchar())!='\n'){
- meret++;
- s=(char*)realloc(s,meret);/*lefoglat memoria dinamikus novelese*/
- s[meret-2]=c;
- s[meret-1]=0;/*string vegjel*/
- }
- }
- printf("A(z) %s stringet adtad meg.",s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement