Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- //sajat fuggveny deklaracio
- int karakterszamolo(char *p);
- void nagybetuvelir(char *p);
- void forditvair(char *p);
- int main(void)
- {
- char *p;
- p = "This is a test string.";
- char *start = p;
- char str[ ] = "This is a test string.";
- int i;
- char *str_start = str;
- printf("The text: %s\n", p);
- int hossz = karakterszamolo(p);
- /*int db = 0;
- while(*p) {
- db++;
- p++;
- }//Itt a p poiter a szoveg vegere mutat*/
- printf("The length of the text: %d\n", hossz);
- //p =start;
- printf("The text: %c\n", *p);
- printf("Nagybetuvel:");
- nagybetuvelir(p);
- /*
- while(*p){
- printf("%c", toupper(*p));
- p++;
- }*/
- printf("\nThe text: %s\n", p); // Eredeti szoveg
- /*
- for(i=0; str[i]!='\0'; i++);{
- str[i] = toupper(str[i]);
- }// A pointer a szoveg vegere mutat
- //str = str_start;
- printf("\nThe text: %s\n", str);*/
- forditvair(p);
- return 0;
- }
- // sajat fuggveny definicio
- int karakterszamolo(char *p){
- int db = 0;
- while(*p){
- db++;
- p++;
- }
- return db;
- }
- void nagybetuvelir(char *p){
- while(*p){
- printf("%c", toupper(*p));
- p++;
- }
- return ;
- }
- void forditvair(char*p){
- printf("\nMegforditva:\n");
- while(*p) p++;
- p--;
- while(*p){
- printf("%c", *p);
- p--;
- }
- return ;
- }
Advertisement
Add Comment
Please, Sign In to add comment