Poniter On String
the output will be 'D3 Teknik Informatika' how to make the output will be 'Laboratorium Teknik Informatika'. please
1 2 3 4 5 6 7 8 9 10
|
#include<stdio.h>
int main()
{
char name[] = "Dion";
char *Address= "Laboratorium D3 Teknik Informatika";
Address+=13;
printf("Name = %s\n", name);
printf("Address = %s\n", Address);
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#include <iostream>
using namespace std;
int main()
{
char c[]= "Laboratorium D3 Teknik Informatika\n";
char *Address= c;
int i =-1;
while(true) {
i++;
if(Address[i]=='\n') break;
if( i>=13 && i<=15 ) continue;
cout << Address[i];
}
return 0;
}
|
5 6
|
const char *Address= "Laboratorium D3 Teknik Informatika";
Address+=13;
|
Last edited on
Topic archived. No new replies allowed.