Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- char* funkcja(char *tab)
- {
- int a;
- a=strlen(tab);
- char* nowa=new tab[a+3];
- char* pocz=nowa; // wskaźnik na początek tego łańcucha, bo w whilezwiększamy wskaźnik i nie można go noralnie zwrocic
- while(*tab) //alternatywa od tego while to strcpy(nowa, tab);
- {
- *nowa=*tab;
- nowa++;
- tab++;
- }
- for(int i=0; i<3; i++)
- {
- *nowa='!';
- nowa++;
- }
- return pocz;
- }
- int main()
- {
- char tab[]="funkcja";
- cout<<funkcja(tab);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement