Pointer on String

this program will be output 'Street N0.5'. How to make the output become 'Sesame No.5'? please help

1
2
3
4
5
6
7
8
9
#include<stdio.h>
int main()
{
    char name[] = "Dion";
    char *Address= "Sesame Street No.5";
    Address+=7;
    printf("Name = %s\n", name);
    printf("Address = %s\n", Address);
}
Erase the "Street".
Just kidding,
You can do it like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<stdio.h>
int main()
{
    char name[] = "Dion";
    char *Address= "Sesame Street No.5";
    
  
    printf("Name = %s\n", name);
      
    
    int x = 1;
    do
    {
       
        if(x == 1){
            printf("Address = ");
            x--;
        }
        printf("%c", *Address++);
        
        if(*Address == '\0') break;
        if(*Address == Address[7]){
                Address += 7;
        }
        
    }while(Address);  
}
}

Last edited on
thankss
Topic archived. No new replies allowed.