Commit 08f78bac by videid

lab14

parent 57872619
Showing with 19 additions and 8 deletions
#include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
...@@ -9,11 +9,13 @@ ...@@ -9,11 +9,13 @@
int main(void){ int main(void){
char s[] = "azerty"; char s[] = "azerty";
char ss[] = "azerty"; char ss[] = "azerty";
char sss[] = "azerty azerty";
char b[64]={0}; char b[64]={0};
char c[64]={0}; char c[64]={0};
char ch[1]={0}; char ch[1]={0};
char *p; char *p;
char arr[64] = {0}; char arr[64] = {0};
char arr2[64] = {0};
int a; int a;
puts("enter string for concatenation"); puts("enter string for concatenation");
gets(b); gets(b);
...@@ -40,19 +42,28 @@ int main(void){ ...@@ -40,19 +42,28 @@ int main(void){
else { else {
puts("same string found"); puts("same string found");
} }
char *e;
for(a=0;a<strlen(b);a++){ for(a=0;a<strlen(b);a++){
printf("\n%s",strstr(&b[a],&ch[0])); *e = b[a];
if (strstr(&b[a],&ch[0])== NULL){ if (strstr(e,&ch[0])== NULL){
arr[a]=b[a]; strcat(arr,e);
} }
else{
} }
}
puts(arr); puts(arr);
printf("modified function is %d characters long",strlen(arr)); printf("modified function is %d characters long\n",strlen(arr));
char k;
for(a=0;a<strlen(sss);a++){
k = sss[a];
printf("\v"); //the \v isn't displaying anything on my compiler but when i change it to \n it shows my code is working
if (isspace(k)){
}
else{
printf("%s",&k);
}
}
} }
......
No preview for this file type
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment